How to Restore a Deleted Let's Encrypt Cert (Nginx Authenticator, Certbot)

January 21, 2019

Assume you delete the certificate by mistake

certbot delete --cert-name www.domain.com

Trying to add back the domain doesn’t work anymore with the following error

[emerg] BIO_new_file(“/etc/letsencrypt/live/www.mydomain.com/fullchain.pem”) failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen(‘/etc/letsencrypt/live/www.mydomain.com/fullchain.pem’,‘r’) error:2006D080:BIO routines:BIO_new_file:no such file)

sudo certbot --nginx -d www.mydomain.com

Find the nginx configuration file for your domain at /etc/nginx/sites-available and remove all line with # managed by Certbot.

Check for nginx configuration error and reload nginx.

sudo nginx -t
sudo nginx -s reload

Try to add the domain again.

sudo certbot --nginx -d www.mydomain.com
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.