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/;
}
}
(Mas substitua localhost: 3000 pelo host do seu aplicativo Rails)