What exactly my certificate is attached to

When I have a certificate issued to a domain or subdomain, is it in any way tied to the file itself in sites-available or sites-enabled, or is it simply tied to the server block(s) within those files?

i.e. Can I rename the files in my sites-available & sites-enabled directories without affecting my certificates? Also, it might be outside the bounds of this particular forum, but would that harm whatever services I have running?

Example: I have a mail subdomain for my TLD - mail.domain.tld - whose config file is currently just named mail. If I change that filename to mail.domain.tld (and properly re-link its associated sites-available entry), will anything be harmed?

2 Likes

Yes, renaming your virtual host files is safe.

Certbot doesn't mind or even remember which file it installed the certificate to. That's all done by looking at each individual virtualhost, regardless of where it is located.

The one negative side effect this could have is if you ever plan to use certbot rollback to undo the changes made by Certbot, because it might restore files back to their pre-renamed state. But I would be surprised if anybody ever uses this feature.

5 Likes