How to Make Self-Signed, Shared SSL Work in a Single IP cPanel

xinchen

Registered
Jul 13, 2012
1
0
1
cPanel Access Level
DataCenter Provider
I searched cPanel forum and internet, even opened a ticket, but didn't find a definitive solution on that. The solution might be there somewhere but I didn't find it. So I figured out a way to achieve it and like to share it with you, using two fake accounts as an example. You will need to have root access to the server.

Fake Accounts
account & domain 1: acctme my.domain.com
account & domain 2: acctyou your.domain.net

cPanel Server
CENTOS 5.10 x86_64 standard – web WHM 11.44.1 (build 11)

Goal
Make the following work on a self-signed SSL
https://my.domain.com
https://your.domain.net

Steps
1. At WHM SSL/TSL section, generate and install a certificate for my.domain.com

2. Click Manage SSL Hosts and make SSL of my.domain.com shared

3. ssh to the server and login as root

4. Open /usr/local/apache/conf/httpd.conf

5. Locate <VirtualHost xxx.xxx.xxx.xxx:443> that has my.domain.com as server name, where xxx.xxx.xxx.xxx is your cPanel server IP

6. Copy the whole section of <VirtualHost xxx.xxx.xxx.xxx:443> ... </VirtualHost> to a temporary file and quit httpd.conf

7. Edit the temorary file and replace the content as follows

  • acctme -> acctyou
    my.domain.com -> your.domain.net
    domain.com -> domain.net

8. WHM -> Apache Configuration -> Include Editor. Select Post Virtual Host Include and select apache version

9. Copy the content of the temporary file, paste it into the input area and click Update

Now you can visit https://my.domain.com and https://your.domain.net, each shows its own home page.

Hope this can save others' time who are looking for the same solution.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,883
2,256
463
Hello :)

Note that the better option is to simply install the certificate directly via Web Host Manager. SNI is supported with CentOS/RHEL/CloudLinux versions 6 and higher, so you can install multiple certificates on the same IP address.

Thank you.