Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted
  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)

share|improve this answer
add comment

Your Answer

 
discard

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.