How to add a subdomain to Certbot

When you register a new subdomain for your domain, ie. example.existing.com, you need to add it to your certbot to avoid unsecure connection warnings for your users.


Kalle Tolonen
June 15, 2023
Last updated on Aug. 26, 2023

Requirements

The magic

Make sure you have A-records on your DNS-provider that point subdomain towards your main domain:

www.newsubdomain    A   3600    123.my.ip.goes.here

Log in to your server and enter

sudo certbot --expand -d www.mydomain.com,www.newsubdomain.mydomain.com

Bang!

The result should be:

Deploying certificate Successfully deployed certificate for www.mydomain.com to /etc/apache2/sites-enabled/thisisyourconf.conf Successfully deployed certificate for www.newsubdomain.mydomain.com to /etc/apache2/sites-enabled/thisisyourconf.conf
Your existing certificate has been successfully renewed, and the new certificate has been installed.

Update: The previous certificate is omitted from the server and you can receive notifications about it from Let's Encrypt. You can check your certificate status on your server with:

sudo certbot certificates

Comments

No published comments yet.

Add a comment

Your comment may be published.