宝塔 Nginx 配置 websocket 反向代理。

宝塔配置:

项目伪静态

location /wss {
proxy_pass http://127.0.0.1:9502;#代理到相应地址即可
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}