server { listen 8080; server_name _; # remplacer par votre nom de domaine si nécessaire root /opt/voix-du-peuple/artifacts/voix-du-peuple/dist/public; index index.html; # Sécurité add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "DENY" always; add_header X-XSS-Protection "1; mode=block" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; # Health check location /health { proxy_pass http://127.0.0.1:8000/health; proxy_set_header Host $host; } # API Flask — proxy vers Gunicorn (interne) location /api/ { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 60s; } # Frontend React — SPA location / { try_files $uri $uri/ /index.html; } # Assets statiques — cache long location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ { expires 1y; add_header Cache-Control "public, immutable"; } client_max_body_size 1m; }