How to Add a New Domain to an Existing Certificate with Certbot

This post tells you how to add a new domain to an existing certificate with Certbot.

Description

I have generated a certificate with Certbot and bound the domain a.com to it. Now I want to add the new domain b.com to this existing certificate.


Solution

Check the Certificate

First of all, check the certificate name with the following command.

1
certbot certificates

The information of the certificate will appear like this.

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@localhost ~]# certbot certificates
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Found the following certs:
Certificate Name: a.com
Serial Number: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Key Type: RSA
Domains: a.com
Expiry Date: 2021-07-17 10:45:32+00:00 (VALID: 7 days)
Certificate Path: /etc/letsencrypt/live/a.com/fullchain.pem
Private Key Path: /etc/letsencrypt/live/a.com/privkey.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Note the certificate name a.com.

1
Certificate Name: a.com

Modify the Certificate

Use this command to modify the certificate. Note that -d must contain all domains including the existed a.com and the new b.com.

1
certbot certonly --cert-name a.com -d a.com,b.com

This operation will take the port 80.

Follow the hints to finish adding the new domain b.com.

Buy a cup of coffee for the author.