events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; gzip_vary on; gzip_proxied any; gzip_comp_level 6; gzip_types text/plain text/css text/xml text/javascript application/json application/javascript application/xml+rss; # ⚠️ Désactiver l'exposition de la version Nginx server_tokens off; server { listen 80; server_name localhost; root /usr/share/nginx/html; index index.html; # 🔒 Headers de sécurité globaux add_header X-Frame-Options "DENY" always; add_header X-Content-Type-Options "nosniff" always; add_header X-XSS-Protection "1; mode=block" always; add_header Referrer-Policy "same-origin" always; add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=()" always; add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https:; connect-src 'self' https://api.faildaily.com https://fcm.googleapis.com; object-src 'none'; frame-src 'none';" always; # Cache des assets (images, fonts) location ~* \.(png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; # Réappliquer les headers de sécurité (add_header reset par les blocs location) add_header X-Frame-Options "DENY" always; add_header X-Content-Type-Options "nosniff" always; } # Pas de cache pour JS/CSS (mise à jour fréquente) location ~* \.(js|css)$ { expires -1; add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"; add_header X-Frame-Options "DENY" always; add_header X-Content-Type-Options "nosniff" always; } # Configuration SPA Angular location / { try_files $uri $uri/ /index.html; } # Santé du conteneur location /health { access_log off; return 200 "healthy\n"; add_header Content-Type text/plain; } } } # Cache des assets (images, fonts) location ~* \.(png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; } # Pas de cache pour JS/CSS (mise à jour fréquente) location ~* \.(js|css)$ { expires -1; add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"; } # Configuration SPA Angular location / { try_files $uri $uri/ /index.html; } # Santé du conteneur location /health { access_log off; return 200 "healthy\n"; add_header Content-Type text/plain; } } }