# Redirection de HTTP vers HTTPS
server {
listen 80;
listen [::]:80;
server_name domain.name;
return 301 https://$host$request_uri;
}
# Configuration pour HTTPS
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name domain.name;
root /var/www/nameFolder;
index index.html index.htm index.nginx-debian.html index.php;
ssl_certificate /etc/letsencrypt/live/domain.name/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.name/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
}