# Configuration Nginx pour BNAR # Placez ce fichier dans /etc/nginx/sites-available/bnar # Puis créez un lien symbolique : sudo ln -s /etc/nginx/sites-available/bnar /etc/nginx/sites-enabled/ server { listen 80; server_name votre-domaine.com www.votre-domaine.com; # Redirection HTTPS (décommentez après configuration SSL) # return 301 https://$server_name$request_uri; # Taille max des uploads (100MB) client_max_body_size 100M; # Timeouts pour les gros fichiers proxy_connect_timeout 600; proxy_send_timeout 600; proxy_read_timeout 600; send_timeout 600; # Logs access_log /var/log/nginx/bnar_access.log; error_log /var/log/nginx/bnar_error.log; # Application Node.js location / { proxy_pass http://localhost:3000; 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; # Buffers proxy_buffering off; proxy_request_buffering off; } # Fichiers statiques uploadés location /uploads { alias /var/www/bnar/public/uploads; expires 30d; add_header Cache-Control "public, immutable"; # Autoriser l'accès aux fichiers access_log off; } # Fichiers statiques publics location /public { alias /var/www/bnar/public; expires 7d; add_header Cache-Control "public"; } # Gzip compression gzip on; gzip_vary on; gzip_min_length 1024; gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json application/javascript; } # Configuration HTTPS (après installation de Certbot) # server { # listen 443 ssl http2; # server_name votre-domaine.com www.votre-domaine.com; # # ssl_certificate /etc/letsencrypt/live/votre-domaine.com/fullchain.pem; # ssl_certificate_key /etc/letsencrypt/live/votre-domaine.com/privkey.pem; # ssl_protocols TLSv1.2 TLSv1.3; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # # client_max_body_size 100M; # # access_log /var/log/nginx/bnar_access.log; # error_log /var/log/nginx/bnar_error.log; # # location / { # proxy_pass http://localhost:3000; # 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_buffering off; # proxy_request_buffering off; # } # # location /uploads { # alias /var/www/bnar/public/uploads; # expires 30d; # add_header Cache-Control "public, immutable"; # } # }