2026-07-30 21:18:39 +08:00
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
listen [::]:80;
|
|
|
|
|
server_name _;
|
|
|
|
|
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
index index.html;
|
|
|
|
|
|
2026-09-29 20:54:00 +08:00
|
|
|
# Resolve independent PDA containers at request time; their restart must not block Admin startup.
|
|
|
|
|
resolver 127.0.0.11 valid=10s ipv6=off;
|
|
|
|
|
location = /pda-domestic { return 308 /pda-domestic/; }
|
|
|
|
|
location = /pda-overseas { return 308 /pda-overseas/; }
|
|
|
|
|
location ^~ /pda-domestic/ {
|
|
|
|
|
set $pda_domestic_origin http://pda-domestic-h5-test:80;
|
|
|
|
|
proxy_pass $pda_domestic_origin$request_uri;
|
|
|
|
|
proxy_set_header Host $proxy_host;
|
|
|
|
|
}
|
|
|
|
|
location ^~ /pda-overseas/ {
|
|
|
|
|
set $pda_overseas_origin http://pda-overseas-h5-test:80;
|
|
|
|
|
proxy_pass $pda_overseas_origin$request_uri;
|
|
|
|
|
proxy_set_header Host $proxy_host;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-30 21:18:39 +08:00
|
|
|
# Docker 容器运行正常的检查地址,供 Jenkins 使用。
|
|
|
|
|
location = /healthz {
|
|
|
|
|
default_type text/plain;
|
|
|
|
|
return 200 "ok\n";
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-08 11:33:09 +08:00
|
|
|
location = /runtime-config.js {
|
|
|
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
|
|
|
|
add_header Pragma "no-cache" always;
|
|
|
|
|
add_header Expires "0" always;
|
|
|
|
|
try_files $uri =404;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-30 21:18:39 +08:00
|
|
|
# 前端代码中的 API 前缀为 /api;保持原始路径转给 Gateway。
|
|
|
|
|
location /api/ {
|
2026-08-28 22:12:36 +08:00
|
|
|
client_max_body_size 55m;
|
2026-07-30 21:18:39 +08:00
|
|
|
proxy_pass ${API_UPSTREAM};
|
|
|
|
|
proxy_http_version 1.1;
|
2026-08-27 10:44:12 +08:00
|
|
|
proxy_set_header Host $proxy_host;
|
2026-08-21 11:20:09 +08:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-29 18:47:41 +08:00
|
|
|
# 墨家测量设备使用独立 OpenAPI 前缀,直接转发到统一 Gateway。
|
2026-09-20 09:17:56 +08:00
|
|
|
# 该入口不经过 Admin 前端路由,供设备以固定 AppKey/HMAC 调用。
|
|
|
|
|
location /openapi/ {
|
|
|
|
|
client_max_body_size 55m;
|
|
|
|
|
proxy_pass ${API_UPSTREAM};
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Host $proxy_host;
|
2026-09-29 20:54:00 +08:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Domestic PDA keeps its H5 module-safe prefix; authorization still belongs to the same Gateway.
|
|
|
|
|
location /gateway-api/ {
|
|
|
|
|
client_max_body_size 55m;
|
|
|
|
|
proxy_pass ${API_UPSTREAM}/api/;
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Host $proxy_host;
|
2026-09-20 09:17:56 +08:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-30 21:18:39 +08:00
|
|
|
|
2026-08-03 15:50:24 +08:00
|
|
|
# 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;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-30 21:18:39 +08:00
|
|
|
# Vue Router 的 history 路由刷新时仍返回 index.html。
|
|
|
|
|
location / {
|
|
|
|
|
try_files $uri $uri/ /index.html;
|
2026-08-03 15:50:24 +08:00
|
|
|
add_header Cache-Control "no-cache" always;
|
2026-07-30 21:18:39 +08:00
|
|
|
}
|
|
|
|
|
}
|