Add subdomain to a Let’s Encrypt SSL certificate

First of all, add an entry to the DNS zone; you can do this in your host panel.

Pointer records = A

Target = IP of the server

 

Remove existing one with this command:

sudo rm -rf /etc/letsencrypt/live/example.com

sudo rm /etc/letsencrypt/renewal/example.com.conf

sudo rm -rf /etc/letsencrypt/archive/example.com

Stop server:

sudo service nginx stop

Create a new one certificate:

cd /opt/letsencrypt
./letsencrypt-auto certonly --standalone

Then add all domaines there separated by comma;

example.com www.example.com subdomain1.example.com sub2.example.com

Restart server:

sudo service nginx restart

Update nginx sites

sudo rm /etc/nginx/sites-enabled/example.com

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

Leave a Comment

Your email address will not be published. Required fields are marked *