server { listen 7860; server_name localhost; root /usr/share/nginx/html; index index.html; # Single Page App: 如果找不到请求的静态文件,则返回 index.html location / { try_files $uri $uri/ /index.html; } # 可选:短时间缓存静态资源 location ~* \.(?:css|js|jpg|jpeg|gif|png|svg|ico|woff2?|ttf|eot)$ { expires 7d; add_header Cache-Control "public"; } }