1

This might not be possible, but I have a nginx server running with one domain x.com, and I have y.com that's pointing to the same server, but I would like that domain to end up running a rails route. So x.com runs /, and y.com runs x.com/2/ - not a redirection, not a rewrite. How can I set my nginx.conf for this?

VNO
  • 121
  • 5

1 Answers1

2
  server {
    listen       80;
    server_name  y.com;
    location / {
      proxy_pass        http://localhost:3000/;
    }   
  }

  server {
    listen       80;
    server_name  x.com;
    location / {
      proxy_pass        http://localhost:3000/2/;
    }   
  }

(But replace localhost:3000 with the host of your Rails app)