Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two Rails applications (say app1 and app2) deployed using Nginx/Passenger. The server definition in nginx.conf looks like this:

server {
        rails_env demo;
        client_max_body_size 50M;
        listen       80;
        server_name  localhost;
        root /data/apps;
        passenger_enabled on;
        passenger_base_uri /app1;
        passenger_base_uri /app2;

You can see that both are configured to use demo as the RAILS_ENV. How should I change my configuration to run both the apps in different environments. Let's assume app2 is suppose to run with RAILS_ENV=qa and app1 with RAILS_ENV=demo

share|improve this question

You could try adding location statemants for the paths like

location /app1 {
    rails_env demo

location /app2 {
    rails_env qa
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.