nginx 配置 websocket

pull/79/head
李强 2022-11-24 00:16:43 +08:00
parent bc6790c631
commit 0a05a97308
1 changed files with 16 additions and 0 deletions

View File

@ -23,4 +23,20 @@ server {
rewrite ^/api/(.*)$ /$1 break; #重写
proxy_pass http://177.8.0.12:8000/; # 设置代理服务器的协议和地址
}
location /ws {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Nginx-Proxy true;
set_real_ip_from 0.0.0.0/0;
proxy_redirect off;
client_max_body_size 10m;
proxy_pass http://177.8.0.12:8000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_connect_timeout 600s;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
}
}