# 前端容器内部 nginx —— 负责 SPA 路由回退 server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # 关键:所有找不到的路径回退到 index.html(Vue Router history 模式必需) location / { try_files $uri $uri/ /index.html; } # 静态资源缓存 location /assets/ { expires 30d; add_header Cache-Control "public, immutable"; } }