修复: 修复分享链接404错误 - install.sh中的nginx配置错误
## 问题 分享链接访问时报404错误,例如 /s/OjTHZiPg 无法访问 ## 原因分析 install.sh中nginx配置有误: 问题: 1. location /s 会匹配 /s 和 /s/xxx 2. 访问 /s/OjTHZiPg 时,nginx会查找文件 frontend/OjTHZiPg/share.html 3. 实际应该代理到后端 /s/:code 路由,让后端重定向到 /share.html?code=xxx ## 修复内容 将 location /s 改为代理到后端: 修复范围: - HTTP配置(第1196-1200行) - HTTPS配置(第1269-1273行) ## 部署说明 已部署用户需要: 1. 拉取最新代码 2. 重新运行安装脚本,或手动更新nginx配置 3. 重载nginx: systemctl reload nginx 影响:分享功能将恢复正常
This commit is contained in:
22
install.sh
22
install.sh
@@ -1193,10 +1193,13 @@ server {
|
||||
proxy_connect_timeout 300s;
|
||||
}
|
||||
|
||||
# 分享页面
|
||||
location /s {
|
||||
alias ${PROJECT_DIR}/frontend;
|
||||
try_files /share.html =404;
|
||||
# 分享页面(代理到后端处理重定向)
|
||||
location /s/ {
|
||||
proxy_pass http://localhost:${BACKEND_PORT};
|
||||
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 $scheme;
|
||||
}
|
||||
|
||||
# 静态资源
|
||||
@@ -1266,10 +1269,13 @@ server {
|
||||
proxy_connect_timeout 300s;
|
||||
}
|
||||
|
||||
# 分享页面
|
||||
location /s {
|
||||
alias ${PROJECT_DIR}/frontend;
|
||||
try_files /share.html =404;
|
||||
# 分享页面(代理到后端处理重定向)
|
||||
location /s/ {
|
||||
proxy_pass http://localhost:${BACKEND_PORT};
|
||||
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 $scheme;
|
||||
}
|
||||
|
||||
# 静态资源
|
||||
|
||||
Reference in New Issue
Block a user