# 看板 · 容器内站点配置 # # 由 kanban 容器挂载到 /etc/nginx/conf.d/default.conf。 # 站点根目录是容器内的 /usr/share/nginx/html,对应宿主机 /opt/kanban/dist。 # 宿主机不需要装 Nginx —— 80/443 由已有的 Nginx Proxy Manager 接管,反代到本容器。 server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; charset utf-8; # 构建产物带 hash,长期强缓存(只加一条 Cache-Control,避免与 expires 叠加) location /assets/ { add_header Cache-Control "public, max-age=31536000, immutable"; try_files $uri =404; } # Service Worker 与入口 HTML 不能缓存,否则发布后客户端停在旧版本 location = /sw.js { expires off; add_header Cache-Control "no-cache, no-store, must-revalidate"; } location = /index.html { expires off; add_header Cache-Control "no-cache, no-store, must-revalidate"; } location = /manifest.webmanifest { default_type application/manifest+json; expires off; add_header Cache-Control "no-cache"; } # 前端路由:/today 刷新时磁盘上没有该文件,必须回落 location / { try_files $uri $uri/ /index.html; } gzip on; gzip_vary on; gzip_min_length 1024; gzip_types text/plain text/css application/javascript application/json application/manifest+json image/svg+xml; }