server { listen 8080 http2; # HTTP/2 for efficient multiplexing listen 8080 quic reuseport; # HTTP/3 support http3_max_concurrent_streams 128; # Root directory for content root /usr/share/nginx/html; index index.html; # Server name (adjust as needed) server_name yourdomain.com www.yourdomain.com; # Security headers add_header X-Frame-Options "DENY" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "no-referrer" always; add_header Permissions-Policy "geolocation=(), microphone=(), camera=(), payment=()" always; # Content Security Policy (CSP) for js, css, and html only add_header Content-Security-Policy "default-src 'self'; script-src 'self' https://trusted.cdn.com https://metrics.nixc.us; style-src 'self' 'unsafe-inline' https://trusted.cdn.com; connect-src 'self' https://metrics.nixc.us; frame-src 'self';"; # Caching headers for JavaScript and CSS files location ~* \.(js|css|html)$ { expires 1y; add_header Cache-Control "public, max-age=31536000, immutable"; } # Rate limiting to prevent abuse limit_req_zone $binary_remote_addr zone=default:10m rate=20r/s; limit_req_status 429; location / { limit_req zone=default burst=30; try_files $uri $uri/ =404; } # HTTP/3 advertisement header add_header Alt-Svc 'h3-29=":8080"; ma=86400'; # Advertise HTTP/3 to clients }