How do I set my RAILS_ENV with Passenger and Apache?
Asked Answered
U

1

6

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!

Unable answered 26/7, 2015 at 13:26 Comment(1)
Do you use Capistrano or something else to deploy your app?Dictation
A
7

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.

Albertson answered 26/7, 2015 at 14:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.