nginx 配置 websocket
1. 配置代码
server {
listen 9900;
server_name 103.108.121.136;
location /ws/ {
# 必须使用http 1.1
proxy_http_version 1.1;
# 设置请求头为ws请求方式
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://127.0.0.1:9930;
}
}
如果文章对您有所帮助,可以点一下推荐