Skip to content

Instantly share code, notes, and snippets.

@iamdionysus
Last active August 29, 2015 14:02
Show Gist options
  • Save iamdionysus/de3873dddd71fadaf261 to your computer and use it in GitHub Desktop.
Save iamdionysus/de3873dddd71fadaf261 to your computer and use it in GitHub Desktop.
How to make passenger work with rails 4.1

Issue

rails 4.1 production setting uses secret_key_base by reading values from the environment for security reason. If ENV["SECRET_KEY_BASE"] doesn't exist nginx + passenger will raise error. You can simply set up envrionment variable in the shell, but under rvm, it sometimes gets tricky.

Solution

Use figaro gem and set it up

  • Gemfile, add gem 'figaro' and bundle update
  • figaro install : this does
    • create config/application.yml
    • append .gitignore
  • config/application.yml, add SECRET_KEY_BASE: your_key
  • your_key can be generated by rake secret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment