server { listen 80; server_name localhost; root /usr/share/nginx/html; # Enable CORS for all requests add_header Access-Control-Allow-Origin "*" always; add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always; add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept" always; # Gzip compression gzip on; gzip_vary on; gzip_min_length 1024; gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json application/javascript image/svg+xml; # Cache static assets location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|json|xml)$ { expires 30d; add_header Cache-Control "public, immutable"; # Re-add CORS headers for cached files add_header Access-Control-Allow-Origin "*" always; } # Default location location / { autoindex on; try_files $uri $uri/ =404; } # Health check endpoint location = /health { access_log off; return 200 "healthy\n"; } }