SSL for subdomain (not for a new site)

Hi guys,

Does anyone know how to add SSL to a subdomain of an existing ee wordpress site. I have setup a subdomain successfully by editing the site config. The main site with SSL is mydomain.com and the subdomain cdn.mydomain.com which points to a subdirectory of the main site i.e. wordpress upload folder. This is all working apart from the ssl on the sub domain.

Any ideas?

It is all the same.

ee site update cdn.domain.com --le

Just don’t forget to configure www. both in Nginx and in DNS.

Thanks for the reply. The thing is, I don’t want it to create a new site as the subdomain is simply pointing to a folder on the main domain (i’ve added the sub domain within the main sites .conf file which works great). It’s just that I need to add SSL to the subdomain without having to create a new site / location. Does that make sense? i.e. the subdomain is pointing to the uploads folder on the main domain.

I can’t help you in this case, sorry.

You could try below:

apt-get -y install certbot
certbot certonly --webroot -w /var/www/mydomain.com/public/your_target_subdirectory -d cdn.mydomain.com

In you site configuration, add this:

ssl_certificate   /etc/letsencrypt/live/cdn.mydomain.com/fullchain.pem;
ssl_certificate_key   /etc/letsencrypt/live/cdn.mydomain.com/privkey.pem;

If your subdomain configuration is in the same server block than your main domain, you have to generate a SSL certificate with SAN support to add the subdomain in the same certifciate.

Otherway, you can use let’s encrypt manually : https://kb.virtubox.net/knowledgebase/install-ssl-certificate-lets-encrypt-manually/

install certbot for ubuntu 16.04 like this:

sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
apt-get -y install certbot

soruce