点域到轨道路线

这可能是不可能的,但我有一个nginx服务器运行一个域x.com,我有y.com指向同一台服务器,但我希望该域最终运行轨道路线。 所以x.com运行/和y.com运行x.com/2/ – 不是redirect,而不是重写。 我如何设置我的nginx.conf?

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/; } } 

(但是用您的Rails应用程序的主机replacelocalhost:3000)