Translate

Monday, September 1, 2014

Nginx with Passenger Giving Bad Gateway 502 Error

Recently i have installed and configured nginx with passenger, and
When deployed and configured, Nginx reports a 502 Bad Gateway exception. Digging throught the Nginx error log (in /var/log/nginx), the error becomes clear:
Exception RuntimeError in Rack application object (Missing secret_key_base for 'production' environment, set this value in config/secrets.yml)
Opening secrets.yml shows that there is no value for production:
development:
  secret_key_base: **not_for_prying_eyes**

test:
  secret_key_base: **not_for_prying_eyes**

# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
You can either set an environment variable, or directly configure a value here (you can run rake secret to generate a key). Just make sure that if you do the latter, you've added secrets/yml to your .gitignore!

No comments:

Post a Comment