How to set RAILS_ENV using Passenger and Apache?

Today I was everywhere looking for a way to set my RAILS_ENV correctly for the Passenger. I want to use the test environment now that the site is on my server, but I do not want this to be production because I am having problems with the database.

I was redirected to this part of the documentation , but for me it made no sense. I had PassengerAppEnv RAILS_ENV = 'test'in my Apache.conf file for the site and - as expected - this did not work.

I also installed Rails RAILS_ENV = 'test'in config/environment.rbmy site, but that didn't work either.

Thank!

+4
source share
1 answer

You are close, but not quite correct. Here's how you install 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>

. Apache:

 Name [space] <value>

, Ruby.

+3

Source: https://habr.com/ru/post/1599728/


All Articles