Certbot

Generate a certificate for nginx

$ sudo certbot --nginx
$ sudo certbot --nginx -d example.com

List all the certificates

$ sudo certbot certificates

NOTE: check each nginx conf files updated by Certbot

Delete a specific certificate

$ sudo certbot delete --cert-name example.com

EXPAND, add a new domain to existing certificate

$ sudo certbot certonly --expand --cert-name existingdomain -d existingdomain.com,www.existingdomain.com,new.existingdomain.com

ADDITIONAL info added 10/09/2024

In case, accidentally deleted a certificate, here how to fix.

sudo certbot certonly --standalone -d deletedDomainname.com

Since still nginx.conf contain information about the deleted certificate, it need reissue certificate ONLY = certonly flag to avoide nginx error such as:

nginx: [emerg] cannot load certificate "/etc/letsencrypt/live/domainname.com/fullchain.pem": BIO_new_file() failed (SSL: error:80000002:system library::No such file or directory:calling fopen(/etc/letsencrypt/live/domainname.com/fullchain.pem, r) error:10000080:BIO routines::no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed