How to add a security certificate to apache or nginx with letsencrypt
Install and configure Certbot to issue and renew TLS certificates via Let’s Encrypt for Apache or nginx.
Install
sudo apt update
sudo apt install snapd
sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
Create a certificate for Apache
sudo certbot --apache
Create a certificate for nginx
sudo certbot --nginx
Renew
sudo certbot renew
Revoke
sudo certbot revoke --cert-path /etc/letsencrypt/live/www.example.com/fullchain.pem