官网 http://nginx.org/en/docs/http/websocket.html
第一个nginx
server {
listen 6794;
root /mnt/dist;
location /analyze/ {
proxy_pass http://ip:port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
try_files $uri $uri/ =404;
}
}
第二个
server {
listen 6791;
root /mnt/dist;
location /visual/ws/ {
proxy_pass http://ip:port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /task/ {
proxy_pass http://ip:port;;
}
location /visual/ {
proxy_pass http://ip:port;
}
location /analyze {
rewrite /analyze(.*) $1 last;
}
location / {
try_files $uri $uri/ =404;
}
}
标签:set,websocket,header,ip,nginx,proxy,转发,http,location From: https://blog.51cto.com/u_12890843/5982387