Rails 2.3.3 - Setting to production mode

爷,独闯天下 提交于 2019-12-10 13:40:17

问题


How do I set the application to production mode?

Okay, this must be a no-brainer but I'm about to deploy my first Rails app and I've got everything setup properly: Ubuntu Hardy, Passenger, MySQL. However, it's still running in development mode. I've only been able to find documentation for older versions of Rails and want to make sure that I'm doing it right.

Thanks in advance.


回答1:


You'll need to set the RackEnv instead of RailsEnv. Actually, I just do both (although I mightn't need to...?).

Example vhost for a Rails 2.3 app:

<VirtualHost *:80>

  ...
  RackEnv production
  RailsEnv production
  ...

</VirtualHost>



回答2:


passenger by default runs everything in production mode unless you specify otherwise:

Passenger RailsEnv documentation

If you create a view that outputs RAILS_ENV, does it say 'development'?

  • If so, then you may have set the RAILS_ENV variable to 'development' somewhere in your environment.rb file.
  • If you're not seeing that, and are seeing other symptoms, then could you list the symptoms?



回答3:


Based on the docs you can set RailEnv. By default Passenger runs in production mode so maybe you copied RailsEnv development into your config.



来源:https://stackoverflow.com/questions/1326576/rails-2-3-3-setting-to-production-mode

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