Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set my RAILS_ENV with Passenger and Apache?

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!

like image 681
IIllIIll Avatar asked Jul 26 '15 13:07

IIllIIll


1 Answers

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.

like image 117
Jacob Margason Avatar answered Oct 02 '22 15:10

Jacob Margason