events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; # Configuration des logs log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; error_log /var/log/nginx/error.log warn; # Configuration générale sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # Configuration de compression gzip on; gzip_vary on; gzip_min_length 10240; gzip_proxied expired no-cache no-store private must-revalidate auth; gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json; # Configuration du serveur server { listen 80; server_name localhost; # Limite de taille des fichiers client_max_body_size 50M; # Configuration des headers de sécurité add_header X-Frame-Options "SAMEORIGIN" 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; # Proxy vers l'application RegisFlow location / { proxy_pass http://regisflow: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; proxy_read_timeout 86400; } # Configuration pour les fichiers statiques location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { proxy_pass http://regisflow:5000; expires 1y; add_header Cache-Control "public, immutable"; } # Health check location /health { proxy_pass http://regisflow:5000/health; access_log off; } } }