0

我正计划构建一个可以以编程方式设置子服务器并使用 nginx/ha 将它们沙箱化的环境。首先,我会确保*.example.com指向 nginx/ha。然后,例如,我会将 app 设置x为仅提供服务x.example.com,然后允许 appx与 app 的特定方法对话y,我将添加以下配置:

server { 
    server_name x.example.com;

    location /y/allowed/method/ {
        proxy_pass y.example.com;
    }
}

(以及相应的 haproxy 配置,如果我要使用 ha)

我的问题是,我可以在给定的 nginx 或 haproxy 实例中包含多少这样的服务器和位置,同时仍保持高性能?我知道我可以将访问限制上移一层到应用程序本身,尽管我更喜欢在网络层

编辑:答案在下面的评论中。本质上,如果配置可以放入 RAM,则性能不会受到影响。

4

1 回答 1

1

您应该生成具有许多服务器块(每个域一个)的 nginx 配置,如下所示:

server { 
    server_name x.example.com;

    location /y/allowed/method/ {
        proxy_pass y;
    }
}

参考:

于 2013-03-03T13:50:51.523 回答