nginx 启用websocket支持
- nginx.conf修改配置
http {
# http段增加
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
...
server {
location ... {
# location段增加
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
}