简体   繁体   English

Rails 2.3.3 - 设置为生产模式

[英]Rails 2.3.3 - Setting to production mode

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. 好吧,这一定是不费脑子的,但我要部署我的第一个Rails应用程序,我已经正确设置了一切: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. 我只能找到旧版本Rails的文档,并希望确保我做得对。

Thanks in advance. 提前致谢。

You'll need to set the RackEnv instead of RailsEnv. 您需要设置RackEnv而不是RailsEnv。 Actually, I just do both (although I mightn't need to...?). 实际上,我只是做两件事(虽然我可能不需要......?)。

Example vhost for a Rails 2.3 app: Rails 2.3应用程序的示例vhost:

<VirtualHost *:80>

  ...
  RackEnv production
  RailsEnv production
  ...

</VirtualHost>

passenger by default runs everything in production mode unless you specify otherwise: 除非您另行指定,否则默认情况下,乘客会以生产模式运行

Passenger RailsEnv documentation Passenger RailsEnv文档

If you create a view that outputs RAILS_ENV, does it say 'development'? 如果您创建一个输出RAILS_ENV的视图,它会说“开发”吗?

  • If so, then you may have set the RAILS_ENV variable to 'development' somewhere in your environment.rb file. 如果是这样,那么您可能已在您的environment.rb文件中的某处将RAILS_ENV变量设置为'development'。
  • If you're not seeing that, and are seeing other symptoms, then could you list the symptoms? 如果你没有看到,并且看到其他症状,那么你能列出症状吗?

Based on the docs you can set RailEnv. 根据文档,您可以设置RailEnv。 By default Passenger runs in production mode so maybe you copied RailsEnv development into your config. 默认情况下,Passenger以生产模式运行,因此您可能将RailsEnv development复制到您的配置中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM