【发布时间】:2015-10-20 01:53:05
【问题描述】:
我有多个 ASP.NET 应用程序在单个 IIS 服务器上运行,每个应用程序具有不同的端口。
我在同一台服务器上安装了 nginx,这样我的客户就可以只使用端口 80 访问我的所有应用程序。
Nginx 在 80 端口上运行良好。我的个人 ASP.NET 应用程序也已启动并运行。
我在 nginx 配置文件中进行了这些更改
location /students/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:84;
}
location /registration/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:82;
}
然后我重新启动了 nginx 并在浏览器中输入了 url http://127.0.0.1/students/。 Nginx 提供 404 页面。
我没有对 conf 文件进行其他更改。
我做错了什么?
【问题讨论】:
-
该配置看起来完全正确;我们在我的工作中有非常相似的配置,使用 proxy_pass,在一个没有 URI 部分的位置块内,将请求传递到 URI 不变的不同服务器。能否验证 Nginx 是否进入了 location 块?