server {
    listen 80;
    server_name _;
    root /usr/share/nginx/html;
    index index.html;

    # MIME types
    types {
        text/html                   html htm;
        application/json            json;
        application/manifest+json   webmanifest;
        text/javascript             js;
        image/webp                  webp;
        image/png                   png;
    }

    # Service Worker: No caching
    location = /sw.js {
        add_header Cache-Control "no-cache, no-store, must-revalidate";
        add_header Pragma "no-cache";
    }

    # Static assets: Long-term cache
    location ~* \.(png|webp|ico)$ {
        expires 30d;
        add_header Cache-Control "public, immutable";
    }

    # SPA/PWA routing support
    location / {
        try_files $uri $uri/ /index.html;
    }
}
