nginx.conf 的http段内增加如下代码:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
在对应的server段内增加如下代码:
location /dctrl/ws {
proxy_pass http://10.217.20.102:8093;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
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 $connection_upgrade;
proxy_set_header Origin "";
}
location 配置根据websocket地址配置,比如地址为:ws://10.217.20.102/dctrl/ws
,配置就按照上面示例