Messed up nginx configuration after deleting some certificates and now nginx wont start so I can't renew my certificates

I accidentally made multiple certificates with the same domain (while I was learning how to use the program). After that I deleted the certificates using certbot delete and now when I run the command below it gives me an error.

My domain is: yiannis-charalambous.com

I ran this command: certbot --nginx -d yiannis-charalambous.com,www.yiannis-charalambous.com,muc.yiannis-charalambous.com,upload.yiannis-charalambous.com

It produced this output:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running nginx -c /etc/nginx/nginx.conf -t.

nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/muc.yiannis-charalambous.com/fullchain.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/muc.yiannis-charalambous.com/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed

The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running nginx -c /etc/nginx/nginx.conf -t.\n\nnginx: [emerg] BIO_new_file("/etc/letsencrypt/live/muc.yiannis-charalambous.com/fullchain.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen(\'/etc/letsencrypt/live/muc.yiannis-charalambous.com/fullchain.pem\',\'r\') error:2006D080:BIO routines:BIO_new_file:no such file)\nnginx: configuration file /etc/nginx/nginx.conf test failed\n')

My web server is (include version): nginx version: nginx/1.14.2

The operating system my web server runs on is (include version): Debian 4.19.181-1

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don't know): yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 0.31.0

Fixed this by going into /etc/nginx/sites-available/default and deleting all the things made by certbot (they were commented). Then restarted nginx and everything was fine.

I'm left wondering exactly how you deleted the certificates and what state certbot is in at this time...
If you don't mind, please show the output of:
certbot certificates

It seems to be fine now.

Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Found the following certs:
  Certificate Name: yiannis-charalambous.com
    Domains: yiannis-charalambous.com muc.yiannis-charalambous.com upload.yiannis-charalambous.com www.yiannis-charalambous.com
    Expiry Date: 2021-11-27 15:46:39+00:00 (VALID: 89 days)
    Certificate Path: /etc/letsencrypt/live/yiannis-charalambous.com/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/yiannis-charalambous.com/privkey.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Excellent.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.