Install Wildcard SSL for sub-domains on the same IP

cPanel default setup does not allow to setup a Wildcard SSL for sub-domain on the same IP via its web interface. But it can be done relatively easily using the following instructions.

First install a Wildcard SSL for the primary domain as you normally would via cPanel/WHM. Use *.yourdomain.tld for your domain name so it will work on sub-domain as well.

Next you will need to copy SSL file from /var/cpanel/userdata/$USER/yourname.tld_SSL to /var/cpanel/userdata/$USER/$SUBDOMAIN.$YOURDOMAIN_SSL for each sub-domain you want to create.

For example if your primary domain is exmaple.com and a username is 'example' and you would like to create mysubdomain.exmaple.com you would need to copy /var/cpanel/userdata/example/example.com_SSL to /var/cpanel/userdata/example/mysubdomain.example.com_SSL

Now you need to edit /var/cpanel/userdata/$USER/$SUBDOMAIN.$YOURDOMAIN_SSL for each sub-domain. (/var/cpanel/userdata/example/mysubdomain.example.com_SSL as per our example above)

  • update documentroot to point to your sub-domain folder (ie /home/example/subdomains/mysubdomain).
  • update servername to your sub-domain (ie mysubdomain.example.com)

The last step is to run scripts/rebuildhttpdconf to rebuild the httpd.conf file with the new VirtualHosts, and restart apache by running /scripts/restartsrv_httpd.

You may get the following warning, which is normal. This warning indicates that there is more than one SSL on the same IP, which is what we want.

info [rebuildhttpdconf] 'local' datastore in use (/var/cpanel/conf/apache/local)
warn [rebuildhttpdconf] Failed to resolve duplicate SSL VirtualHosts: mysubdomain.example.com_SSL and example.com_SSL
Built /usr/local/apache/conf/httpd.conf OK

Let me know if you have any questions.

 

 

 

 

Would you like to contribute?



Free business joomla templates