如何在 nginx 中部署多个 rails 应用程序,其中一个在根目录中? [英] How can I deploy multiple rails app in nginx with one in the root?

查看:56
本文介绍了如何在 nginx 中部署多个 rails 应用程序,其中一个在根目录中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个 rails 应用程序.现在我希望将它们部署到

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

app1  /
app2  /app2/

这可能吗?

我使用的是乘客、nginx 和 rails 3.2

I'm using passenger,nginx and rails 3.2

如果这不可能,我如何将/"重定向到/app1"?

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

推荐答案

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

这篇关于如何在 nginx 中部署多个 rails 应用程序,其中一个在根目录中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆