server { listen 80; server_name _; absolute_redirect off; port_in_redirect off; root /usr/share/nginx/html; index index.html; # Configurações para proxy reverso (Traefik) real_ip_header X-Forwarded-For; set_real_ip_from 0.0.0.0/0; # Cabeçalhos de segurança add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header X-XSS-Protection "1; mode=block" always; # Logs access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; # Cache de assets estáticos location ~* \.(?:js|mjs|css|png|jpg|jpeg|gif|svg|ico|woff2?)$ { expires 7d; add_header Cache-Control "public, max-age=604800, immutable"; try_files $uri =404; } # SPA routing - todas as rotas vão para index.html location / { try_files $uri $uri/ /index.html; } # Health check endpoint (opcional) location /health { access_log off; return 200 "OK"; add_header Content-Type text/plain; } }