在 Windows 服务器上使用 nginx 我想使用非域名名称将流量引导到不同的端口,第一个有效但第二个永远无法到达:为什么?怎么了? http://192.xxx.xxx.xxx/game:工作 http://192.xxx.xxx.xxx/cms:永远达不到。如果我更改名称,则 cms 可以正常工作,并且游戏永远无法到达。
server {
listen 80;
server_name game;
location /{
proxy_pass http://localhost:4040;
proxy_connect_timeout 60s;
proxy_read_timeout 5400s;
proxy_send_timeout 5400s;
proxy_set_header host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect default;
}
location /uploads/ {
root c:\Ebrahimi\www\appGame;
}
}
server {
listen 80;
server_name cms;
location /{
proxy_pass http://localhost:2010;
proxy_connect_timeout 60s;
proxy_read_timeout 5400s;
proxy_send_timeout 5400s;
proxy_set_header host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect default;
}
location /uploads/ {
root c:\Ebrahimi\www\appCms;
}
}
“Richard Smith”提到的新代码块:
server {
listen 80;
location /{
proxy_pass http://localhost:4040;
proxy_connect_timeout 60s;
proxy_read_timeout 5400s;
proxy_send_timeout 5400s;
proxy_set_header host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect default;
}
location /uploads/ {
root c:\Ebrahimi\www\appGame;
}
location /game {
proxy_pass http://localhost:4040;
}
location /cms{
proxy_pass http://localhost:2010;
}
}