1. 修改nginx.conf文件:
http
{
......
#websocket配置
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server
{
......
location /upstream/
{
proxy_pass http://10.0.0.22:8080/upstream/;
proxy_redirect default;
#websocket配置
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Origin "";
}
......
}
......
}
2. 重启nginx:
nginx -s stop
./nginx