apt-get update
apt-get install git
git clone https://github.com/letsencrypt/letsencrypt /srv/letsencrypt --depth=1
<pre> server {
# .well-known doit rester accessible
location ~ /\.well-known/acme-challenge {
allow all;
}
# On interdit habituellement l'accès au dotfiles
location ~ /\. { deny all; access_log off; log_not_found off; }
} </pre>
<pre> /srv/letsencrypt/letsencrypt-auto certonly –rsa-key-size 4096 –webroot –webroot-path /var/www/mondomaine.fr -d mondomaine.fr </pre>
Le certificat est généré dans ce répertoire
/etc/letsencrypt/live/
listen 443 ssl http2; listen [::]:443 ssl http2;
servername Le certificat est généré dans ce répertoire <code>mondomaine.fr; root /var/www/mondomaine.fr; index index.html index.htm; errorlog /var/log/nginx/mondomaine.fr.log notice; access_log off;
#### Locations # On cache les fichiers statiques location ~* .(html|css|js|png|jpg|jpeg|gif|ico|svg|eot|woff|ttf)$ { expires max; } # On interdit les dotfiles location ~ /. { deny all; }
#### SSL ssl on; sslcertificate /etc/letsencrypt/live/mondomaine.fr/fullchain.pem; sslcertificate_key /etc/letsencrypt/live/mondomaine.fr/privkey.pem;
sslstapling on; sslstaplingverify on; ssltrustedcertificate /etc/letsencrypt/live/mondomaine.fr/fullchain.pem; # Google DNS, Open DNS, Dyn DNS resolver 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 216.146.35.35 216.146.36.36 valid=300s; resolvertimeout 3s;
#### Session Tickets # Session Cache doit avoir la même valeur sur tous les blocs “server”. sslsessioncache shared:SSL:100m; sslsessiontimeout 24h; sslsessiontickets on; sslsessionticket_key /etc/nginx/ssl/ticket.key;
# [ATTENTION] Les paramètres Diffie-Helman doivent être générés ssl_dhparam /etc/nginx/ssl/dhparam4.pem;
#### ECDH Curve sslecdhcurve secp384r1; sslprotocols TLSv1 TLSv1.1 TLSv1.2; sslpreferserverciphers on; ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK';
} </pre>
Pour le renouvellement c'est très simple, la commande suivante renouvellera automatique tous les certificats le nécessitant:
<pre> /srv/letsencrypt/letsencrypt-auto renew </pre>
certbot certonly –webroot –webroot-path DOCROOT -d DOMAINE.TLD
Un grand merci à grafikart.fr pour son tuto clair !
https://www.grafikart.fr/formations/serveur-linux/nginx-ssl-letsencrypt