Us administrators eventually come to the realization that when you have a wildcard SSL certificate for 40 subdomains, you can’t practically have separate IPs and cPanel accounts for all of them. If you have a wildcard SSL certificate for all your su
bdomains, you can easily install the certificate on a single IP address for all the subdomains. For this particular scenario to work:
- All subdomains must be on the same IP and cPanel account
- You must have a wildcard SSL qualifying for *.tld.com
Keep in mind that for a wildcard SSL to work, it really does have to be installed for each subdomain. You can’t install it once and have it automatically work in the fly like wildcard DNS does – Apache just doesn’t work that way. Luckily, we’ve scripted an easy solution for you.
Create the following files:
This file will contain the actual certificate, and should be named off of your top-level domain. For example, if the certificate is for *.mydomain.com, name the file mydomain.com.crt
This file will be the CA bundle for your wildcard certificate, if you have one. If the certificate is for *.mydomain.com, name the file mydomain.com.cabundle
Now download the install script from here.
This is basically just a bash script that you can use to install a wildcard SSL for a domain. Running it will install the certificate on all subdomains of the domain passed to the script:
chmod 755 wildcardssl.sh
After it runs, all you need to do is restart Apache. Please make a copy of /var/cpanel/userdata before running the script for the first time, until you’ve verified that it works on your setup. Please note that this script would need to be run again if more subdomains are added later on.