Nginx反代理Websocket配置例子
upstream ws_svr {
server 127.0.0.1:6688 weight=1;
}
server {
listen 8899;
server_name127.0.0.1;
location / {
#proxy_redirect off;
proxy_pass http://ws_svr;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
#proxy_set_header Origin "";
}
}
说明:流程是nginx的8899端口反代理6688的ws端口,客户端链接可以直接ws://127.0.0.1:8899
页:
[1]