Nginx/Passenger/Rails, where to set RAILS_ENV?

不羁的心 提交于 2019-11-29 02:18:24

问题


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?


回答1:


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;
}



回答2:


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



来源:https://stackoverflow.com/questions/19083881/nginx-passenger-rails-where-to-set-rails-env

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!