修复: Nginx上传大小限制导致413错误 v1.2.1
问题描述: - 上传大于6MB的文件时出现413错误 - Nginx默认client_max_body_size为1MB 修复内容: - 添加 client_max_body_size 500M(支持500MB文件上传) - 添加上传超时设置(proxy_read_timeout 300s) - 添加发送超时设置(proxy_send_timeout 300s) - 添加连接超时设置(proxy_connect_timeout 75s) - 同时修复HTTP和HTTPS配置 影响范围: - install.sh: configure_nginx_http() 函数 - install.sh: configure_nginx_https() 函数 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
16
install.sh
16
install.sh
@@ -1165,6 +1165,9 @@ server {
|
|||||||
listen ${HTTP_PORT};
|
listen ${HTTP_PORT};
|
||||||
server_name ${server_name};
|
server_name ${server_name};
|
||||||
|
|
||||||
|
# 文件上传大小限制(500MB)
|
||||||
|
client_max_body_size 500M;
|
||||||
|
|
||||||
# 前端静态文件
|
# 前端静态文件
|
||||||
location / {
|
location / {
|
||||||
root ${PROJECT_DIR}/frontend;
|
root ${PROJECT_DIR}/frontend;
|
||||||
@@ -1183,6 +1186,11 @@ server {
|
|||||||
proxy_set_header X-Real-IP \$remote_addr;
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||||
|
|
||||||
|
# 上传超时设置(大文件上传可能需要更长时间)
|
||||||
|
proxy_read_timeout 300s;
|
||||||
|
proxy_send_timeout 300s;
|
||||||
|
proxy_connect_timeout 75s;
|
||||||
}
|
}
|
||||||
|
|
||||||
# 分享页面
|
# 分享页面
|
||||||
@@ -1230,6 +1238,9 @@ server {
|
|||||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
ssl_prefer_server_ciphers on;
|
ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
|
# 文件上传大小限制(500MB)
|
||||||
|
client_max_body_size 500M;
|
||||||
|
|
||||||
# 前端静态文件
|
# 前端静态文件
|
||||||
location / {
|
location / {
|
||||||
root ${PROJECT_DIR}/frontend;
|
root ${PROJECT_DIR}/frontend;
|
||||||
@@ -1248,6 +1259,11 @@ server {
|
|||||||
proxy_set_header X-Real-IP \$remote_addr;
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||||
|
|
||||||
|
# 上传超时设置(大文件上传可能需要更长时间)
|
||||||
|
proxy_read_timeout 300s;
|
||||||
|
proxy_send_timeout 300s;
|
||||||
|
proxy_connect_timeout 75s;
|
||||||
}
|
}
|
||||||
|
|
||||||
# 分享页面
|
# 分享页面
|
||||||
|
|||||||
Reference in New Issue
Block a user