Files
ggl/nginx-rewrite-fixed.conf
2025-09-23 07:35:11 +00:00

36 lines
1.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# API请求代理到后端4001端口
location /api/ {
proxy_pass http://127.0.0.1:4001;
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;
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
# 上传文件代理
location /uploads/ {
proxy_pass http://127.0.0.1:4001;
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;
}
# 静态资源直接访问排除uploads目录
location ~* ^(?!/uploads/).*\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
root /www/wwwroot/ggl/dist;
expires 1y;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
# Vue Router History模式支持 - 前端路由
location / {
root /www/wwwroot/ggl/dist;
try_files $uri $uri/ /index.html;
index index.html;
}