Pour sécuriser un site web, nous devrons utiliser le protocole HTTPS qui nécessite un certificat SSL obtenu auprès d une Autorité de Certification (qui facture un abonnement annuel). Let s encrypt est une AC qui fournit gratuitement et de manière très simple ces certificats.
Il suffit de suivre les indications sur la page Getting started. Si vous avez accès au shell du serveur, l installation est grandement faciliter par l utilisation du script Certbot pour les différentes phases :
.
Après installation, mon serveur est dédoublé en 2 virtual serveurs :
<IfModule mod_rewrite.c>
RewriteEngine On
http://localhost:8080/VirtualHostBase/http/ _
www.caotek.fr:80/VirtualHostRoot/_vh_zoperoot$1 [P,L]
RewriteRule ^/prive - [L]
http://localhost:8080/VirtualHostBase/http/ _
www.caotek.fr:80/caotek2/VirtualHostRoot/$1 [P,L]
RewriteCond %{SERVER_NAME} =caotek.fr [OR]
RewriteCond %{SERVER_NAME} =www.caotek.fr
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,QSA,R=permanent]
ProxyVia on
</IfModule>
<Directory \"/var/www/\">
allow from all
Options None
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/zoperoot(.*) http://localhost:8080/VirtualHostBase/https/ _
www.caotek.fr:443/VirtualHostRoot/_vh_zoperoot$1 [P,L]
RewriteRule ^/prive - [L]
RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/https/ _
www.caotek.fr:443/caotek2/VirtualHostRoot/$1 [P,L]
ProxyVia on
</IfModule>
<Directory \"/var/www/\">
allow from all
Options None
</Directory>
SSLCertificateFile /etc/letsencrypt/live/caotek.fr/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/caotek.fr/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/caotek.fr/chain.pem
sudo certbot --version
sudo certbot certificates
sudo certbot renew --dry-run
sudo certbot renew
sudo certbot renew --cert-name exemple.com
sudo certbot renew --cert-name exemple.com --force-renewal
sudo certbot certonly --nginx --cert-name exemple.com -d exemple.com -d www.exemple.com --dry-run
sudo certbot certonly --nginx --cert-name exemple.com -d exemple.com -d www.exemple.com --force-renewal
sudo certbot delete --cert-name exemple.com
sudo certbot revoke --cert-name exemple.com
sudo systemctl status certbot.timer
sudo systemctl list-timers | grep certbot
sudo journalctl -u certbot.service -n 50 --no-pager
sudo tail -n 100 /var/log/letsencrypt/letsencrypt.log
sudo nginx -t
Publié le : 16-04-2026 - 15:09