3

I need to change the domain on my server, which I've been using certbot to get certificates for successfully. I need to switch it to a different domain though. I did not set it up initially so I have no idea how it was done, and can't figure out how to look at the current configuration.

Every answer I've found says I need to refer to the 'webroot' directory, but I'm not sure which that is exactly. It also says the requested nginx plugin does not appear to be installed so I don't think I'm doing it right if that's not how it was done initially.

Ubuntu 16.4 + nginx

edit: after installing the nginx problem, I got a new cert, but it's pointing to the wrong webroot (which is what I was trying to lookup but it's not in the config file)

1 Answer 1

2

You can learn about your existing certificates by checking out the old domain's .conf file in /etc/letsencrypt/renewal/ or by doing sudo certbot certificates

If you have changed domain name you can just install the nginx plugin

sudo apt install python-certbot-nginx

obtain a new certificate with

sudo certbot -d [newdomain.tld] --nginx

Afterwards you can check if there are any old, no longer needed certificates configured with

sudo certbot certificates

You will likely find an entry there for the cert with your old domain name. Remove that with

sudo certbot delete

and interactively pick which old ones to delete. This is important so that later you can just issue sudo certbot renew and not get errors due to the no longer relevant domain failing to authorize.

Restart nginx and you are done.

4
  • Welcome to Server Fault! This is a great first answer. Checking the configuration file will definitely tell you how the certificate was obtained, though it doesn't give you the exact command line that was used. It is enough information to reconstruct it though. Feb 10, 2019 at 2:47
  • So this worked I think, but it's not going to the right webroot (which is what I was afraid of) and now my site just says "Welcome to nginx!"
    – stackers
    Feb 10, 2019 at 18:10
  • Examine /etc/nginx/conf.d and see what .conf files are listed there.
    – Centurion
    Feb 11, 2019 at 20:33
  • /etc/letsencrypt/renewal/ gives me some directories with config files that tell me where certificates are put. But it doesn't tell me how these certificates are configured, i.e. which domains are part of which certificate. Mar 21, 2023 at 21:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .