Sunday, March 4, 2012

cPanel: SSL on subdomain howto


First, let’s lay out the situation. You have a site named mystore.com. It has a cart so you’ve set it up with SSL. Now, you’re redesigning it and have the subdomain newsite.mystore.com set up under your main account in cPanel for your redesign space. You’ve started your redesign, but you find out quickly that SSL is not set up on this new subdomain and you can’t find a way within cPanel to accomplish this.
cPanel gives you two options for SSL on subdomains:
1. Set up your subdomain as it’s own account
- This will easily allow you to assign it its own IP address, but a bit of an annoyance if you’ve already started developing in its current space.
2. Modify some files to assign it its own IP address – and leave it where it sits under your current account
- This is a little tricky for some, but not if you follow our instructions. Will require root access to the machine.
Since option #1 is pretty self explanatory, we’ll show you how to accomplish this with option #2.
Find and reserve an IP address so it’s not used again in the future:
1. Open WHM and go to: IP Functions –> Show IP Address Usage
- pick out an IP address that is not being used, jot it down. We’ll choose 192.168.1.2
2. go to: IP Functions –> Show/Edit IP Address Usage
- find 192.168.1.2 in the list and enter newsite.mystore.com in the text box next to it. Click save and verify it stuck.
Change the userdata file for the subdomain:
(We’ll assume your username on the box is ‘mystore’)
1. SSH into the machine and become root
2. cd into the correct directory to do some modifications:
# cd /var/cpanel/userdata/mystore
3. edit your newsite config file:
# vim newsite.mystore.com
4. Change the ip address on/around line 15:
Before: ip: 192.168.1.1
After: ip: 192.168.1.2
5. Close/save file
6. Tell cpanel to save the changes so it doesn’t get overwritten in the future:
# /usr/local/cpanel/scripts/rebuildhttpdconf
7. Restart apache
# /usr/local/cpanel/scripts/restartsrv_apache
8. Correct the DNS for the subdomain
9. Generate/enter cert information for new subdomain
Done!

No comments:

Post a Comment