宝塔nginx配置方法如下:
在站点的配置文件中 server 节点上面添加如下内容
- map $http_upgrade $connection_upgrade {
- default upgrade;
- '' close;
- }
- upstream websocket {
- server 域名:端口;
- }
复制代码
------------------------------------------------分割------------------------------------------------
找到配置文件中的 #SSL-END 在后面添加如下内容
- #wss协议转发
- location /wss {
- proxy_pass http://127.0.0.1:9326;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "Upgrade";
- }
复制代码
------------------------------------------------分割------------------------------------------------
最后保存文件,一般情况下会生效,如果 没有生效,重启nginx
|
|