server { listen 80; server_name quantumtaskai.com www.quantumtaskai.com; root /usr/share/nginx/html; index index.html; charset utf-8; # ── Security headers ───────────────────────────────────────── add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header X-XSS-Protection "1; mode=block" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always; # ── Gzip compression ───────────────────────────────────────── gzip on; gzip_types text/plain text/css text/javascript application/javascript application/json image/svg+xml; gzip_min_length 1024; # ── Caching: HTML (1 hour) ─────────────────────────────────── location ~* \.html$ { add_header Cache-Control "public, max-age=3600, must-revalidate"; add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; try_files $uri $uri/ =404; } # ── Caching: Static assets (1 year) ───────────────────────── location ~* \.(ico|png|jpg|jpeg|webp|gif|svg|woff|woff2|ttf|js|css)$ { add_header Cache-Control "public, max-age=31536000, immutable"; access_log off; try_files $uri =404; } # ── Caching: sitemap and robots (1 day) ───────────────────── location ~* \.(xml|txt)$ { add_header Cache-Control "public, max-age=86400"; try_files $uri =404; } # ── www → non-www redirect ─────────────────────────────────── if ($host = "www.quantumtaskai.com") { return 301 https://quantumtaskai.com$request_uri; } # ── Main routing ───────────────────────────────────────────── location / { try_files $uri $uri/ $uri.html =404; } # ── 404 page ───────────────────────────────────────────────── error_page 404 /404.html; location = /404.html { internal; } }