# v2 部署本地化:这个 nginx 容器只负责把 /v2/admin/ 下的 SPA 静态文件吐出去 # 对外分流由现网 deploy-admin-1 的 nginx 完成(/v2/admin/ 原样透传、/v2-api/ 转发到 v2 api) server { listen 80; server_name _; client_max_body_size 10m; root /usr/share/nginx/html; location = /v2 { return 301 /v2/admin/; } location /v2/admin/ { try_files $uri $uri/ /v2/admin/index.html; } # v2 版 H5(构建时 router.base 必须为 /v2/h5/,产物放 /usr/share/nginx/html/v2/h5) location = /v2/h5 { return 301 /v2/h5/; } location = /v2/h5/index.html { add_header Cache-Control "no-cache"; } # v2 版 H5(构建时 router.base 必须为 /v2/h5/,产物放 /usr/share/nginx/html/v2/h5) # 性能整改 P0-2:哈希文件名的构建产物长缓存,index.html 永远 no-cache(上面精确匹配优先) location /v2/h5/ { try_files $uri $uri/ /v2/h5/index.html; location ~* ^/v2/h5/(static|assets|img|fonts?)/ { expires 30d; add_header Cache-Control "public"; } } location / { return 404; } }