19

I've deployed my site to its testing location, but I'm not sure where I set what the RAILS_ENV should be for this server. Where should I look?

Josh M.
  • 26,437
  • 24
  • 119
  • 200

2 Answers2

40

Short Answer: passenger_app_env development;

Sets: RAILS_ENV RACK_ENV WSGI_ENV NODE_ENV PASSENGER_APP_ENV

Example nginx conf:

    http {
    passenger_root /home/user/.rvm/gems/ruby-2.1.0@app/gems/passenger-4.0.29;
    passenger_ruby /home/user/.rvm/wrappers/ruby-2.1.0@app/ruby;
    passenger_app_env development;
}
Abs
  • 3,902
  • 1
  • 31
  • 30
  • 2
    this is true answer..:) – Sumit Munot Nov 13 '14 at 18:52
  • 1
    This can also be done using the PASSENGER_APP_ENV environment variable for containerized solutions. [See the Passenger documentation for more info](https://github.com/phusion/passenger-docker#application-environment-name-rails_env-node_env-etc) – Jon Sep 10 '18 at 18:52
1

You can use rack_env directive to set the rails env as described here in passenger for nginx documentation

6.16. Rack and Rails >= 3 specific options

If you are on rails 1.x or 2.x, you can use rails_env directive

Litmus
  • 10,558
  • 6
  • 29
  • 44