# Configuration Nginx pour RegisFlow Production # À placer dans /etc/nginx/sites-available/regisflow server { listen 80; server_name votre-domaine.com www.votre-domaine.com; # Redirection HTTPS (recommandé) return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; server_name votre-domaine.com www.votre-domaine.com; # Certificats SSL (Let's Encrypt recommandé) ssl_certificate /etc/letsencrypt/live/votre-domaine.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/votre-domaine.com/privkey.pem; # Configuration SSL moderne ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384; ssl_prefer_server_ciphers off; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; # Headers de sécurité add_header X-Frame-Options DENY; add_header X-Content-Type-Options nosniff; add_header X-XSS-Protection "1; mode=block"; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; add_header Referrer-Policy "strict-origin-when-cross-origin"; # Taille maximale pour les uploads (photos) client_max_body_size 50M; # Timeouts proxy_connect_timeout 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; proxy_buffers 32 4k; proxy_buffer_size 8k; # Compression gzip on; gzip_vary on; gzip_min_length 1024; gzip_proxied any; gzip_comp_level 6; gzip_types text/plain text/css text/xml text/javascript application/json application/javascript application/xml+rss application/atom+xml image/svg+xml; # Cache pour les assets statiques location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ { proxy_pass http://localhost:5000; 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; expires 30d; add_header Cache-Control "public, immutable"; access_log off; } # API endpoints (pas de cache) location /api/ { proxy_pass http://localhost:5000; 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; # Pas de cache pour les API add_header Cache-Control "no-cache, no-store, must-revalidate"; add_header Pragma "no-cache"; add_header Expires "0"; } # Health check location /health { proxy_pass http://localhost:5000; access_log off; } # Application principale location / { proxy_pass http://localhost:5000; 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; # Cache court pour les pages expires 1h; add_header Cache-Control "public"; } # Logs access_log /var/log/nginx/regisflow-access.log; error_log /var/log/nginx/regisflow-error.log; }