server { listen 80; listen [::]:80; server_name localhost; charset utf-8; charset_types text/xml text/plain text/vnd.wap.wml application/javascript application/rss+xml text/css application/json; #access_log /var/log/nginx/host.access.log main; location /sw.js { root /app; add_header Cache-Control "no-cache, immutable"; } location ~* \.(?:ico|gif|jpe?g|png|woff2?|eot|otf|ttf|svg|js|css|webmanifest)$ { root /app; add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable"; } location / { root /app; index index.html; add_header Cache-Control "no-cache"; # 取消绝对路径的重定向 absolute_redirect off; } error_page 404 500 502 503 504 /404.html; location = /404.html { root /app; add_header Cache-Control "no-cache"; } server_tokens off; }