# Configuration Nginx pour RegisFlow Production # Placez ce fichier dans /etc/nginx/sites-available/regisflow # Puis créez un lien : ln -s /etc/nginx/sites-available/regisflow /etc/nginx/sites-enabled/ server { listen 80; server_name votre-domaine.com www.votre-domaine.com; # Redirection automatique vers HTTPS return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; server_name votre-domaine.com www.votre-domaine.com; # Configuration 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 sécurisée 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; # Sécurité headers add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; 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 "strict-origin-when-cross-origin" always; add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self';" always; # Configuration des logs access_log /var/log/nginx/regisflow_access.log; error_log /var/log/nginx/regisflow_error.log; # Limite de taille des uploads client_max_body_size 10M; # Configuration du proxy vers RegisFlow location / { proxy_pass http://127.0.0.1:5000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; 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_cache_bypass $http_upgrade; # Timeouts proxy_connect_timeout 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; } # Optimisations pour les fichiers statiques location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { proxy_pass http://127.0.0.1:5000; expires 1y; add_header Cache-Control "public, immutable"; } # Health check location /health { proxy_pass http://127.0.0.1:5000/health; access_log off; } # Protection contre les attaques location ~ /\. { deny all; access_log off; log_not_found off; } # Limitation du taux de requêtes limit_req_zone $binary_remote_addr zone=regisflow:10m rate=10r/s; limit_req zone=regisflow burst=20 nodelay; }