随便加个目录,比如 wss://www.baidu.com/ws
然后在伪静态里增加一个配置(不在伪静态里也行,只是加这里方便)
location /ws
{
proxy_pass http://127.0.0.1:7272/;
proxy_set_header Host 127.0.0.1:7272;
proxy_set_header origin 127.0.0.1:7272;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr;
}
location /web/
{
proxy_pass http://110.42.64.233:8080/;
proxy_set_header Host 110.42.64.233:8080;
proxy_set_header origin 110.42.64.233:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_http_version 1.1;
# proxy_hide_header Upgrade;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
}
这个是记录下反向连接,怎么样能忽略掉web这个目录,原文