The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Wildcard SSL installation - ssl subdomain shows main domain

Discussion in 'General Discussion' started by theallan, Feb 28, 2013.

  1. theallan

    theallan Active Member

    Joined:
    Nov 17, 2005
    Messages:
    32
    Likes Received:
    1
    Trophy Points:
    8
    Hello all,

    I'm having some problems installing a wildcard SSL certificate in WHM (11.34). I've got an account which has a detected IP, and it has a domain and sub-domains on it. I'd like those sub-domains all to be able to use ssl (the whole point of the wildcard certificate :) ).

    I've got the certificate installed after having read a load of other threads, by creating a sub-domain called `*` and then installing the wildcard certificate. Now I get the following behaviour:

    http://domain.com - Main site loads
    https://domain.com - Main site loads
    http://sub.domain.com - Sub-domain site loads
    https://sub.domain.com - Main site loads

    The problem being the last part. From what I've read in other posts I need to do some editing of the configuration files or something, and I've tried the suggestions there, but with no success.

    Can anyone point me in the right direction?

    Allan
     
  2. rligg

    rligg Well-Known Member

    Joined:
    Sep 16, 2003
    Messages:
    277
    Likes Received:
    0
    Trophy Points:
    16
    Did you find a solution to this. Please post it.
     
  3. Greenhost

    Greenhost Well-Known Member

    Joined:
    Jan 22, 2013
    Messages:
    92
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
  4. elialum

    elialum Member

    Joined:
    Sep 10, 2008
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Israel
    cPanel Access Level:
    DataCenter Provider
    Hi,

    Please try the following -

    • Reinstall the SSL certificate (if necessary) for *.domain.com as normal in cPanel, using the wildcard cert. Treat it like a normal certificate. That is, enter "domain.com" and not "*.domain.com", and the username USERNAME instead of "nobody".
    • In /var/cpanel/userdata/USER/ copy the example.com_SSL file to $subdomain.DOMAIN.COM_SSL for each subdomain.
    • In each copied file, edit the following variables to match the non-SSL subdomain: documentroot, servername, serveraliases
    • Rebuild the Apache configuration with /scripts/rebuildhttpdconf
    • Restart the Apache server with /scripts/restartsrv_httpd

    An alternative to the above would be to instead setup those subdomains as their very own unique cPanel user accounts with their own unique dedicated IPs. You could then simply install the cert to each unique cPanel account and accomplish the same behavior. This alternative method would be entirely through cPanel/WHM supported methods.
     
  5. theallan

    theallan Active Member

    Joined:
    Nov 17, 2005
    Messages:
    32
    Likes Received:
    1
    Trophy Points:
    8
    @elialum - this is absolutely superb. Thanks very much for the clear and concise instructions. It worked perfectly for me :)

    Allan
     
  6. Dave Smith

    Dave Smith Member

    Joined:
    Mar 20, 2016
    Messages:
    13
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    Lisbon
    cPanel Access Level:
    Root Administrator
    We just had the same issue and stumbled upon this thread. We found an alternative solution, below:

    1) Create the required subdomain and its directory under CPANEL and update DNS to reflect (point to) the new subdomain.

    2) Generate your SSL certificate with Lets Encrypt (or buy an SSL certificate for all your domains which is silly) including the Subdomains you wish to operate.

    Code:
    ./letsencrypt-auto certonly --text --agree-tos --email admin@CHANGEME:COM -d CHANGEME:COM -d www.CHANGEME:COM -d subdomain.CHANGEME:COM --break-my-certs
    
    3) Install the SSL certificate under CPANEL to your respective primary domain by dropping down the select list and picking it. Then paste the required details in to their respective areas, Private Key, Chain, Cert. Then click Install at the bottom.

    4) Do the same as step 3 but select your subdomain from the select list.

    Job done!

    We hope this helps somebody else with the same problem we were having, ie, the new SSL subdomain was directing to the default page for the web root and not the page contained within the subdomain directory itself.
     
    trec-r likes this.
Loading...

Share This Page