# Configuration nginx pour 4nk.network # Redirection HTTP vers HTTPS et service du site statique events { worker_connections 1024; } http { # Redirection HTTP vers HTTPS pour 4nk.network server { listen 80; server_name 4nk.network www.4nk.network; # Redirection permanente vers HTTPS return 301 https://$server_name$request_uri; } # Configuration HTTPS pour 4nk.network server { listen 443 ssl; http2 on; server_name 4nk.network www.4nk.network; # Configuration SSL (certificats auto-signés temporaires) ssl_certificate /etc/ssl/4nk.network/fullchain.pem; ssl_certificate_key /etc/ssl/4nk.network/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:ECDHE-RSA-AES256-SHA384; ssl_prefer_server_ciphers off; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; # Headers de sécurité 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; # Configuration du site root /home/debian/website; index index.html; # Gestion des fichiers statiques location / { try_files $uri $uri/ =404; # Cache pour les fichiers statiques location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; } } # Gestion des erreurs error_page 404 /404.html; # Proxy pour l'API de contact location /contact { proxy_pass http://127.0.0.1:3001; proxy_http_version 1.1; 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; } # Logs access_log /var/log/nginx/4nk.network.access.log; error_log /var/log/nginx/4nk.network.error.log; } }