36 lines
1.0 KiB
Plaintext
36 lines
1.0 KiB
Plaintext
# 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;
|
||
}
|