From d3b9800e35497d8254c4e57d36f5abaad3accbcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=8B=87=E7=A5=A5?= <237899745@qq.com> Date: Tue, 11 Nov 2025 13:08:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E6=97=A0=E6=B3=95=E8=AE=BF=E9=97=AE=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复nginx配置中X-Forwarded-Proto使用错误的问题 - 将 $http_x_forwarded_proto 改为 $scheme - 适配IP直接访问的场景 - 添加client_max_body_size 10G 支持大文件上传 - 增加API代理超时时间配置 - 添加favicon.ico避免404错误 修复后分享链接可以正常访问 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- frontend/favicon.ico | Bin 0 -> 916 bytes nginx/nginx.conf | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 frontend/favicon.ico diff --git a/frontend/favicon.ico b/frontend/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..f1c3b4f2c4a871f0e32e02968d4134a7fb2653d1 GIT binary patch literal 916 xcmZQzU<5(|0R|wcz>vYhz#zuJz@P!dKp~(AL>x#lFaYI7!DtAKh5)TY003+P0Yd-) literal 0 HcmV?d00001 diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 2b9ddd4..11c939d 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -2,6 +2,9 @@ server { listen 80; server_name localhost; + # 设置最大上传文件大小为10GB + client_max_body_size 10G; + # 前端静态文件 location / { root /usr/share/nginx/html; @@ -18,9 +21,14 @@ server { 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-Forwarded-Proto $http_x_forwarded_proto; + # 修复:使用当前请求协议(http或https),适用于直接IP访问 + proxy_set_header X-Forwarded-Proto $scheme; proxy_cache_bypass $http_upgrade; + + # 增加超时时间支持大文件上传 + proxy_connect_timeout 300; + proxy_send_timeout 300; + proxy_read_timeout 300; } # 分享链接重定向 @@ -29,6 +37,7 @@ server { 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-Forwarded-Proto $http_x_forwarded_proto; + # 修复:使用当前请求协议(http或https),适用于直接IP访问 + proxy_set_header X-Forwarded-Proto $scheme; } }