修复: 分享链接无法访问的问题
- 修复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 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user