Nginx + Passenger to serve rails apps in different sub URIs

Let you have 2 directories and wants to configure, make sure u have installed passenger already.

server {
  listen 80;
  server_name 127.0.0.1;

  location /first/ {
    root /home/hector/webapps/first/public;
    passenger_base_uri /first/;

    proxy_pass http://127.0.0.1:3000/;
    proxy_set_header Host $host;
  }
  location /second/ {
    root /home/hector/webapps/second/public;
    passenger_base_uri /second/;

    proxy_pass http://127.0.0.1:3001/;
    proxy_set_header Host $host;
  } 

}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s