Files
admin-web/nginx/default.conf.template
T

47 lines
1.5 KiB
Plaintext
Raw Normal View History

server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Docker 容器运行正常的检查地址,供 Jenkins 使用。
location = /healthz {
default_type text/plain;
return 200 "ok\n";
}
# 前端代码中的 API 前缀为 /api;保持原始路径转给 Gateway。
location /api/ {
2026-08-05 09:11:48 +08:00
client_max_body_size 12m;
proxy_pass ${API_UPSTREAM};
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;
}
# HTML must be revalidated on every visit so a new deployment cannot keep
# referencing hashed chunks that were removed with the previous image.
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
}
# Vite assets are content-hashed and safe to cache permanently. Missing
# chunks must remain a real 404 instead of falling back to index.html.
location /assets/ {
try_files $uri =404;
add_header Cache-Control "public, max-age=31536000, immutable" always;
}
# Vue Router 的 history 路由刷新时仍返回 index.html。
location / {
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache" always;
}
}