bd7635986a
Vue 前端 + FastAPI 后端,含部署脚本与词典数据。 Co-authored-by: Cursor <cursoragent@cursor.com>
38 lines
1016 B
PHP
38 lines
1016 B
PHP
# 由 install-production.sh 复制到 /etc/nginx/conf.d/wordloop-locations.inc
|
||
|
||
location /.well-known/acme-challenge/ {
|
||
try_files $uri =404;
|
||
}
|
||
|
||
location /api/ {
|
||
proxy_pass http://127.0.0.1:18004;
|
||
proxy_http_version 1.1;
|
||
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;
|
||
}
|
||
|
||
location /docs {
|
||
proxy_pass http://127.0.0.1:18004;
|
||
proxy_set_header Host $host;
|
||
}
|
||
|
||
location /openapi.json {
|
||
proxy_pass http://127.0.0.1:18004;
|
||
proxy_set_header Host $host;
|
||
}
|
||
|
||
# 静态资源不存在时必须 404,不能回退 index.html(否则 JS 加载失败页面空白)
|
||
location ^~ /assets/ {
|
||
try_files $uri =404;
|
||
expires 7d;
|
||
add_header Cache-Control "public, immutable";
|
||
}
|
||
|
||
# Vue Router history:/login 等路径回退 index.html
|
||
location / {
|
||
try_files $uri $uri/ /index.html;
|
||
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
||
}
|