与server一级在上面添加
代码语言:javascript复制 map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
在server里配置
代码语言:javascript复制 location /ws {
proxy_pass http://127.0.0.1:24445/agentServer;
proxy_http_version 1.1;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host:$server_port;
}