# ============================================================ # AMYEVOLUTION — VERSION 65 : exemple nginx (HTTPS obligatoire + sécurité) # À utiliser seulement si l'hébergeur fonctionne avec nginx (nginx ne lit pas le .htaccess). # Remplacez les chemins et le domaine, puis : sudo nginx -t && sudo systemctl reload nginx # ============================================================ # 1) Tout ce qui arrive en http:// part vers https:// (301 définitive) server { listen 80; listen [::]:80; server_name amyevolution.tn www.amyevolution.tn; # Renouvellement du certificat Let's Encrypt location ^~ /.well-known/acme-challenge/ { root /var/www/letsencrypt; } location / { return 301 https://www.amyevolution.tn$request_uri; } } # 2) Sans « www » en https -> avec « www » (une seule adresse pour Google) server { listen 443 ssl; listen [::]:443 ssl; http2 on; server_name amyevolution.tn; ssl_certificate /etc/letsencrypt/live/amyevolution.tn/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/amyevolution.tn/privkey.pem; return 301 https://www.amyevolution.tn$request_uri; } # 3) Le site server { listen 443 ssl; listen [::]:443 ssl; http2 on; server_name www.amyevolution.tn; root /var/www/amyevolution/public; index index.php index.html; ssl_certificate /etc/letsencrypt/live/amyevolution.tn/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/amyevolution.tn/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers off; ssl_session_cache shared:SSL:10m; ssl_session_tickets off; server_tokens off; client_max_body_size 8m; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; add_header Permissions-Policy "camera=(), microphone=(), payment=(), usb=(), interest-cohort=(), geolocation=(self)" always; # Fichiers cachés et sensibles interdits (sauf .well-known) location ~ /\.(?!well-known) { deny all; } location ~* \.(sql|sqlite|bak|backup|old|orig|swp|log|ini|sh|zip|7z|tar|gz|rar)$ { deny all; } location ~* ^/(artisan|composer\.(json|lock)|package(-lock)?\.json)$ { deny all; } # Aucun PHP dans le dossier des images envoyées location ~* ^/storage/.*\.(php\d?|phtml|phar)$ { deny all; } location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; fastcgi_param HTTPS on; fastcgi_pass unix:/run/php/php8.3-fpm.sock; fastcgi_hide_header X-Powered-By; } }