How do I set my RAILS_ENV with Passenger and Apache?

为君一笑 提交于 2019-12-10 15:27:11

问题


I've been everywhere today looking for the way to properly set my RAILS_ENV for Passenger. I want to use the test environment now that the site is on my server, but I don't want it to be production because I'm having database issues.

I've been directed to this part of the documentation, but it didn't make any sense to me. I had PassengerAppEnv RAILS_ENV = 'test' in my Apache .conf file for the site and -- as expected -- that didn't' work.

I've also set RAILS_ENV = 'test' in config/environment.rb of my Rails site, but that didn't work either.

Thanks!


回答1:


You're close, but not quite correct. Here is how you set it:

<Directory /path/to/app/public>
Allow from all
Options -Multiviews
# ^ for Apache 2.4+
Require all granted
RailsEnv development # < place desired environment here 
</Directory>

Basically Passenger will see the line in the configuration file and then set it for you. It uses the more Apache style syntax of:

 Name [space] <value>

So you don't need all the quotes or any Ruby style syntax at all.



来源:https://stackoverflow.com/questions/31637484/how-do-i-set-my-rails-env-with-passenger-and-apache

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