2026-02-28 15:29:16 +08:00
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
server_name localhost;
|
2026-03-30 02:53:55 +00:00
|
|
|
resolver 127.0.0.11 valid=30s ipv6=off;
|
2026-02-28 15:29:16 +08:00
|
|
|
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
index index.html;
|
|
|
|
|
|
|
|
|
|
# Frontend SPA
|
|
|
|
|
location / {
|
|
|
|
|
try_files $uri $uri/ /index.html;
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-14 15:24:02 +08:00
|
|
|
# Allow large file uploads (e.g. Excel imports up to 100MB)
|
|
|
|
|
client_max_body_size 100m;
|
|
|
|
|
|
2026-02-28 15:29:16 +08:00
|
|
|
# API proxy
|
|
|
|
|
location /api/ {
|
2026-03-30 02:53:55 +00:00
|
|
|
# Use Docker DNS dynamic resolution to avoid stale container IP after recreate.
|
|
|
|
|
set $gateway_upstream http://gateway:8888;
|
|
|
|
|
proxy_pass $gateway_upstream;
|
2026-02-28 15:29:16 +08:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Upload files
|
|
|
|
|
location /uploads/ {
|
|
|
|
|
alias /usr/share/nginx/uploads/;
|
|
|
|
|
expires 30d;
|
|
|
|
|
add_header Cache-Control "public, immutable";
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-14 15:24:02 +08:00
|
|
|
# Do not aggressively cache entry bundles because file names are stable
|
|
|
|
|
# (for example umi.js / umi.css) and stale cache can cause a blank page
|
|
|
|
|
# after deployment updates.
|
|
|
|
|
location ~* ^/(umi\.js|umi\.css|preload_helper\.js)$ {
|
|
|
|
|
expires -1;
|
|
|
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Cache other static assets that are typically fingerprinted/chunked.
|
2026-02-28 15:29:16 +08:00
|
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
|
|
|
expires 30d;
|
|
|
|
|
add_header Cache-Control "public, immutable";
|
|
|
|
|
}
|
|
|
|
|
}
|