The nginx plugin is not working after delete certificate

I already have run certbot in nextcloud few days.
then today I want to change my domain,
so I ran delete command:

certbot delete

and I want to create new domian

certbot --nginx -d my_new_domain.com

It produced this output:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
No certificates found.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
root@Jail-NextCloud:/usr/local/etc/nginx # certbot --nginx
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running nginx -c /usr/local/etc/nginx/nginx.conf -t.

nginx: [emerg] cannot load certificate "/usr/local/etc/letsencrypt/live/my_domain/fullchain.pem": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/usr/local/etc/letsencrypt/live/my_domain/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /usr/local/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 /usr/local/etc/nginx/nginx.conf -t.\n\nnginx: [emerg] cannot load certificate "/usr/local/etc/letsencrypt/live/my_domain/fullcha

I can login to a root shell on my machine: yes
The version of my client is: 1.22.0

nginx is configured to use a certificate that has been deleted.
Order matters.
You could have obtained the new cert, switched to it, before deleting the existing cert.
Now you must either:

  • remove any reference to the deleted cert
    or
  • use a snakeoil cert in place of the missing one [if you have one, just point to it instead]
    or
  • if nginx is still running, you can use the --webroot option (instead of --nginx)
    [which won't require restarting nginx]
3 Likes

Although the damage is done, if you wish to repair your nginx configuration by using a snakeoil certificate, we have some instructions for that here.

3 Likes

In the future, please read the Certbot documentation before using a function you're not familiair with. Such as the part of the documentation about deleting certificates here:

https://eff-certbot.readthedocs.io/en/stable/using.html#deleting-certificates

2 Likes

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