Prérequis
- Un serveur sous Ubuntu, Debian, AlmaLinux, Rocky, CentOS, Fedora, Alpine ou openSUSE : voir nos VPS au Canada
- Une connexion SSH ouverte en root : Se connecter en SSH à votre VPS
- Un nom de domaine dont l'enregistrement A pointe sur l'adresse IP du serveur (dans ce guide : votredomaine.com, à remplacer)
- Une adresse courriel pour votre compte Let's Encrypt
Let's Encrypt délivre gratuitement des certificats HTTPS reconnus par tous les navigateurs, valables 90 jours et renouvelés sans intervention. Certbot est l'outil qui les demande, les installe dans Nginx et les renouvelle. Ce guide part de zéro : un serveur Nginx pour votre domaine, le pare-feu, Certbot, le certificat avec redirection de HTTP vers HTTPS, puis le renouvellement automatique. Choisissez votre système plus haut.
1Mettre à jour le système
apt update && apt upgrade -y... 212 upgraded, 8 newly installed, 0 to remove and 4 not upgraded. (les nombres dépendent de l'âge de l'image)
dnf upgrade -y... Complete!
dnf upgrade -y... Complete!
apk update && apk upgrade && reboot... OK: 158 MiB in 209 packages (les nombres dépendent de l'image ; la connexion SSH se coupe au redémarrage)
Alpine redémarre après la mise à jour : quand elle remplace le noyau, les modules du noyau en cours disparaissent et le pare-feu de l'étape 4 ne peut plus se charger (« Couldn't determine iptables version »). Reconnectez-vous en SSH après une minute.
zypper -n refresh && zypper -n updateAll repositories have been refreshed. ...
2Installer Nginx
Certbot a besoin d'un serveur web qui répond pour votre domaine : Let's Encrypt vérifie que vous contrôlez le domaine en interrogeant le port 80. Nginx sert aussi de serveur pour votre site ; si vous en avez déjà un, passez cette étape.
apt install -y nginxdnf install -y nginx && systemctl enable --now nginxdnf install -y nginx && systemctl enable --now nginxapk add nginx && rc-update add nginx default && service nginx startzypper -n install nginx && systemctl enable --now nginxnginx -vnginx version: nginx/1.24.0 (Ubuntu)
nginx -vnginx version: nginx/1.20.1
nginx -vnginx version: nginx/1.30.4
nginx -vnginx version: nginx/1.30.4
nginx -vnginx version: nginx/1.27.2
3Déclarer votre domaine dans Nginx
Un dossier pour les fichiers du site, une page d'accueil, et un fichier de configuration qui dit à Nginx de servir ce dossier pour votre domaine. Certbot lira ce fichier pour y ajouter le certificat. Remplacez votredomaine.com par votre domaine, dans les trois boîtes.
mkdir -p /var/www/votredomaine.com && echo '<h1>Bonjour depuis votredomaine.com</h1>' > /var/www/votredomaine.com/index.htmlcat > /etc/nginx/conf.d/votredomaine.com.conf << 'EOF'
server {
listen 80;
server_name votredomaine.com;
root /var/www/votredomaine.com;
index index.html;
}
EOFcat > /etc/nginx/conf.d/votredomaine.com.conf << 'EOF'
server {
listen 80;
server_name votredomaine.com;
root /var/www/votredomaine.com;
index index.html;
}
EOFcat > /etc/nginx/conf.d/votredomaine.com.conf << 'EOF'
server {
listen 80;
server_name votredomaine.com;
root /var/www/votredomaine.com;
index index.html;
}
EOFcat > /etc/nginx/http.d/votredomaine.com.conf << 'EOF'
server {
listen 80;
server_name votredomaine.com;
root /var/www/votredomaine.com;
index index.html;
}
EOFcat > /etc/nginx/vhosts.d/votredomaine.com.conf << 'EOF'
server {
listen 80;
server_name votredomaine.com;
root /var/www/votredomaine.com;
index index.html;
}
EOFSELinux refuse à Nginx de lire un dossier créé à la main sous /var/www tant qu'il n'a pas l'étiquette des contenus web : restorecon la pose.
restorecon -R /var/wwwnginx -t && systemctl reload nginxnginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
nginx -t && systemctl reload nginxnginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
nginx -t && systemctl reload nginxnginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
nginx -t && systemctl reload nginxnginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
nginx -t && rc-service nginx reloadnginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
curl -s -H 'Host: votredomaine.com' http://127.0.0.1/<h1>Bonjour depuis votredomaine.com</h1>
4Ouvrir les ports 80 et 443 dans le pare-feu
Le port 80 sert à la vérification de Let's Encrypt et à la redirection vers HTTPS, le port 443 au site en HTTPS.
apt install -y ufw && ufw allow 22/tcp && ufw allow 80/tcp && ufw allow 443/tcp && ufw --force enable... Firewall is active and enabled on system startup
dnf install -y firewalld && systemctl enable --now firewalld && firewall-cmd --permanent --add-service=http --add-service=https && firewall-cmd --reload... success success
dnf install -y firewalld && systemctl enable --now firewalld && firewall-cmd --permanent --add-service=http --add-service=https && firewall-cmd --reload... success success
apk add ufw && ufw allow 22/tcp && ufw allow 80/tcp && ufw allow 443/tcp && ufw --force enable && rc-update add ufw default... Firewall is active and enabled on system startup * service ufw added to runlevel default
firewall-cmd --permanent --add-service=http --add-service=https && firewall-cmd --reloadsuccess success
5Installer Certbot et son greffon Nginx
Le greffon Nginx permet à Certbot de prouver le domaine à travers Nginx, sans l'arrêter, puis d'écrire lui-même les lignes HTTPS dans la configuration du site.
apt install -y certbot python3-certbot-nginxdnf install -y epel-release && dnf install -y certbot python3-certbot-nginxdnf install -y certbot python3-certbot-nginx python3-pyparsingapk add certbot certbot-nginxzypper -n install python313-certbot-nginxcertbot --versioncertbot 2.9.0
certbot --versioncertbot 3.1.0
certbot --versioncertbot 5.7.0
certbot --versioncertbot 5.6.0
certbot --versioncertbot 5.1.0
6Obtenir le certificat
Une seule commande : Certbot crée votre compte Let's Encrypt avec votre adresse courriel, demande le certificat pour le domaine, l'installe dans la configuration du site et ajoute la redirection de HTTP vers HTTPS.
certbot --nginx -d votredomaine.com --non-interactive --agree-tos -m vous@votredomaine.com --redirectAccount registered. Requesting a certificate for votredomaine.com Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/votredomaine.com/fullchain.pem Key is saved at: /etc/letsencrypt/live/votredomaine.com/privkey.pem This certificate expires on 2026-12-16. ... Successfully deployed certificate for votredomaine.com to /etc/nginx/conf.d/votredomaine.com.conf Congratulations! You have successfully enabled HTTPS on https://votredomaine.com
certbot --nginx -d votredomaine.com --non-interactive --agree-tos -m vous@votredomaine.com --redirectAccount registered. Requesting a certificate for votredomaine.com Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/votredomaine.com/fullchain.pem Key is saved at: /etc/letsencrypt/live/votredomaine.com/privkey.pem This certificate expires on 2026-12-16. ... Successfully deployed certificate for votredomaine.com to /etc/nginx/conf.d/votredomaine.com.conf Congratulations! You have successfully enabled HTTPS on https://votredomaine.com
certbot --nginx -d votredomaine.com --non-interactive --agree-tos -m vous@votredomaine.com --redirectAccount registered. Requesting a certificate for votredomaine.com Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/votredomaine.com/fullchain.pem Key is saved at: /etc/letsencrypt/live/votredomaine.com/privkey.pem This certificate expires on 2026-12-16. ... Successfully deployed certificate for votredomaine.com to /etc/nginx/conf.d/votredomaine.com.conf Congratulations! You have successfully enabled HTTPS on https://votredomaine.com
certbot --nginx -d votredomaine.com --non-interactive --agree-tos -m vous@votredomaine.com --redirectAccount registered. Requesting a certificate for votredomaine.com Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/votredomaine.com/fullchain.pem Key is saved at: /etc/letsencrypt/live/votredomaine.com/privkey.pem This certificate expires on 2026-12-16. ... Successfully deployed certificate for votredomaine.com to /etc/nginx/http.d/votredomaine.com.conf Congratulations! You have successfully enabled HTTPS on https://votredomaine.com
certbot --nginx -d votredomaine.com --non-interactive --agree-tos -m vous@votredomaine.com --redirectAccount registered. Requesting a certificate for votredomaine.com Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/votredomaine.com/fullchain.pem Key is saved at: /etc/letsencrypt/live/votredomaine.com/privkey.pem This certificate expires on 2026-12-16. ... Successfully deployed certificate for votredomaine.com to /etc/nginx/vhosts.d/votredomaine.com.conf Congratulations! You have successfully enabled HTTPS on https://votredomaine.com
Certbot a réécrit le fichier du site : le bloc d'origine écoute maintenant en 443 avec le certificat, et un second bloc renvoie le port 80 vers HTTPS. Les lignes qu'il a ajoutées portent « managed by Certbot ».
cat /etc/nginx/conf.d/votredomaine.com.confserver {
server_name votredomaine.com;
root /var/www/votredomaine.com;
index index.html;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/votredomaine.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/votredomaine.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = votredomaine.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name votredomaine.com;
return 404; # managed by Certbot
}cat /etc/nginx/conf.d/votredomaine.com.confserver {
server_name votredomaine.com;
root /var/www/votredomaine.com;
index index.html;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/votredomaine.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/votredomaine.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = votredomaine.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name votredomaine.com;
return 404; # managed by Certbot
}cat /etc/nginx/conf.d/votredomaine.com.confserver {
server_name votredomaine.com;
root /var/www/votredomaine.com;
index index.html;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/votredomaine.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/votredomaine.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = votredomaine.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name votredomaine.com;
return 404; # managed by Certbot
}cat /etc/nginx/http.d/votredomaine.com.confserver {
server_name votredomaine.com;
root /var/www/votredomaine.com;
index index.html;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/votredomaine.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/votredomaine.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = votredomaine.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name votredomaine.com;
return 404; # managed by Certbot
}cat /etc/nginx/vhosts.d/votredomaine.com.confserver {
server_name votredomaine.com;
root /var/www/votredomaine.com;
index index.html;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/votredomaine.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/votredomaine.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = votredomaine.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name votredomaine.com;
return 404; # managed by Certbot
}7Vérifier le site en HTTPS
curl -sI https://votredomaine.com/ | head -1HTTP/1.1 200 OK
curl -sI http://votredomaine.com/ | head -1HTTP/1.1 301 Moved Permanently
certbot certificatesFound the following certs:
Certificate Name: votredomaine.com
Serial Number: 6f8738e86c87c899fa649f56e0ff9d4cce1
Key Type: ECDSA
Domains: votredomaine.com
Expiry Date: 2026-12-16 14:48:50+00:00 (VALID: 89 days)
Certificate Path: /etc/letsencrypt/live/votredomaine.com/fullchain.pem
Private Key Path: /etc/letsencrypt/live/votredomaine.com/privkey.pemDans le navigateur, https://votredomaine.com affiche le cadenas ; le certificat est émis par Let's Encrypt et valable 90 jours.
8Renouvellement automatique
Certbot renouvelle un certificat quand il lui reste moins de 30 jours, à condition qu'une tâche planifiée le lance chaque jour.
systemctl list-timers | grep certbotFri 2026-09-18 08:46:21 UTC 16h - - certbot.timer certbot.service
systemctl enable --now certbot-renew.timer && systemctl list-timers | grep certbotFri 2026-09-18 00:26:28 UTC 8h left - - certbot-renew.timer certbot-renew.service
systemctl enable --now certbot-renew.timer && systemctl list-timers | grep certbotFri 2026-09-18 06:20:54 UTC 14h - - certbot-renew.timer certbot-renew.service
rc-update add crond default && service crond start && (crontab -l 2>/dev/null; echo "0 3 * * * certbot renew --quiet") | crontab - && crontab -l... 0 3 * * * certbot renew --quiet
zypper -n install cronie && systemctl enable --now cron && (crontab -l 2>/dev/null; echo "0 3 * * * certbot renew --quiet") | crontab - && crontab -l... 0 3 * * * certbot renew --quiet
certbot renew --dry-run... Congratulations, all simulated renewals succeeded: /etc/letsencrypt/live/votredomaine.com/fullchain.pem (success)
Après un renouvellement, le greffon Nginx recharge Nginx lui-même : le nouveau certificat est servi sans intervention.
HTTPS en place
Votre site répond en HTTPS avec un certificat Let's Encrypt, HTTP y renvoie, et le renouvellement tourne seul. Pour un serveur web complet avec PHP, voyez Installer Nginx avec PHP-FPM.
Erreurs fréquentes
L'image du serveur a été construite sur un autre disque et GRUB demande où se réinstaller : choisissez le disque de la machine (celui que lsblk affiche, en général /dev/sda) ; la mise à jour continue ensuite.
Le domaine ne pointe pas encore sur le serveur : vérifiez l'enregistrement A chez votre registraire, attendez la propagation (quelques minutes à quelques heures), puis relancez l'étape 6.
Let's Encrypt n'atteint pas le port 80 du serveur : étape 4 (pare-feu), et vérifiez que Nginx tourne.
SELinux : le dossier du site n'a pas l'étiquette des contenus web. restorecon -R /var/www (étape 3).
Let's Encrypt limite le nombre de certificats par domaine et par semaine. Attendez, et faites vos essais à blanc : certbot certonly --nginx -d votredomaine.com --dry-run ne consomme pas de certificat.
Le greffon Nginx a besoin de python3-pyparsing : la boîte de l'étape 5 l'installe ; ajoutez-le si Certbot était déjà là.