0

I want to have two differents Rails apps in the same server with Thin and Nginx in the same port but in different locations.

Example:

  1. http://domain.com/rails_app_1
  2. http://domain.com/rails_app_2

This is my nginx.conf file with only one app:

upstream domain1 {
    server 127.0.0.1:80;
    server 127.0.0.1:81;
    server 127.0.0.1:82;
}

server {
    listen 80;
    server_name domain.com; 

    access_log /var/www/rails_app_1/current/log/access.log;
    error_log /var/www/rails_app_1/current/log/error.log;

    root   /var/www/rails_app_1/current/public/;
    index  index.html;

    location / {
      proxy_set_header  X-Real-IP  $remote_addr;
      proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_redirect off;
      if (!-f $request_filename) {
                       proxy_pass http://domain1;
                       break;
      }
    }
}

Regards,

Victor
  • 995
  • 1
  • 10
  • 26

0 Answers0