本帖最后由 无色橘子 于 2021-2-12 22:09 编辑
楼上是发了个什么? 没看懂.
Nginx默认的安装配置就支持WS的.
location /8d9rgM7mnCJ8i2TxsyQcR5Z9pFYvxAD4 {
if ( $http_upgrade != "websocket" ) {
return 404;
}
proxy_pass http://127.0.0.1:10001;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host "test.test.com";
#访客IP
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
直接把端口和IP指向你的WS服务地址和端口就行了 |