From e68f4b3693337130508af7300265ce0020e5fefa Mon Sep 17 00:00:00 2001 From: hailin Date: Thu, 19 Jun 2025 18:38:08 +0800 Subject: [PATCH] . --- nginx/updsrv.conf | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/nginx/updsrv.conf b/nginx/updsrv.conf index a8bc36f..4e33360 100644 --- a/nginx/updsrv.conf +++ b/nginx/updsrv.conf @@ -1,9 +1,9 @@ -upstream apiv1 { +upstream apiv11 { server 127.0.0.1:8084; keepalive 64; } -upstream chatws { +upstream chatws1 { server 127.0.0.1:8084; keepalive 64; } @@ -11,12 +11,13 @@ upstream chatws { server { server_name updsrv.szaiai.com; - client_max_body_size 100M; # 这里设置确保适用于所有 HTTPS 请求 + client_max_body_size 100M; location / { return 404; } + # 普通 HTTP 请求处理,不支持 WebSocket location ^~/api/v1 { proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; @@ -26,13 +27,10 @@ server { proxy_set_header X-NginX-Proxy true; proxy_set_header Connection ""; proxy_http_version 1.1; - proxy_pass http://apiv1; - } - - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; + proxy_pass http://apiv11; } + # 仅此处启用 WebSocket 支持 location ^~ /api/v1/deploy/ws/ { proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; @@ -42,11 +40,8 @@ server { proxy_set_header X-NginX-Proxy true; proxy_set_header Connection ""; proxy_http_version 1.1; - proxy_pass http://chatws; - - ## 以下两个配置如果没配置,websocket会报错,链接时使用wss:// proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; + proxy_pass http://chatws1; } - }