How can I deploy multiple rails app in nginx with one in the root?

不羁岁月 提交于 2020-01-06 14:34:35

问题


I have two rails apps.Now I want them deployed to

app1  /
app2  /app2/

is that possible?

I'm using passenger,nginx and rails 3.2

If that's not possible, how can I redirect "/" to "/app1"?


回答1:


upstream rails1 {
    server 127.0.0.1:8000;
    server 127.0.0.1:8001;
    server 127.0.0.1:8002;
}

upstream rails2 {
    server 127.0.0.1:7000;
    server 127.0.0.1:7001;
    server 127.0.0.1:7002;
}

server {
    location / {
        proxy_pass http://rails1;
    }
    location /app2 {
        proxy_pass http://rails2;
    }
}

http://wiki.nginx.org/HttpProxyModule

http://wiki.nginx.org/NginxHttpUpstreamModule#upstream



来源:https://stackoverflow.com/questions/9588713/how-can-i-deploy-multiple-rails-app-in-nginx-with-one-in-the-root

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!