# 供 compose 中 web 容器使用:宿主机挂载 web/dist 与 verify-root,仅提供静态与 SPA 回退 server { listen 80; root /usr/share/nginx/html; index index.html; location ~ ^/([A-Za-z0-9._-]+\.(txt|html|xml))$ { alias /verify-root/$1; } location ^~ /assets/ { try_files $uri =404; access_log off; expires 7d; add_header Cache-Control "public, immutable"; } location = / { try_files /index.html =404; } # 前台为 Vue SPA:任意路径须回退到 index.html,否则直接访问 /xxx 会得到 nginx 404 location / { try_files $uri $uri/ /index.html; } }