server { listen 80; server_name localhost; root /usr/share/nginx/html; index index.html; # Gzip Compression gzip on; gzip_vary on; gzip_min_length 1024; gzip_proxied expired no-cache no-store private auth; gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/javascript application/json image/svg+xml; # iOS PWA & Security Headers add_header X-Frame-Options "SAMEORIGIN"; add_header X-Content-Type-Options "nosniff"; add_header Access-Control-Allow-Origin "*"; location / { try_files $uri $uri/ /index.html; } # Cache Service Worker with no-cache so updates apply immediately location = /sw.js { add_header Cache-Control "no-cache, no-store, must-revalidate"; add_header Pragma "no-cache"; add_header Expires "0"; } # Static assets cache location ~* \.(css|js|json|svg|png|jpg|jpeg|ico)$ { expires 7d; add_header Cache-Control "public, max-age=604800, immutable"; } }