2 domains 1 documentroot

From Cheatsheet
Revision as of 09:19, 13 December 2010 by Admin (talk | contribs)
Jump to navigation Jump to search

This is incase you ever have a customer that has 2 domains that each need their own ip for a ssl, but need the same document root. It would be hard to park the domain and setup 2 SSL certificates, so here is my cheat.

Essentially this is pretty simple to accoplish. This was done on my vps to test it and it does work, all of the command below are exactly what I ran and did.

On my server I made:

proof.shooltz.net  >>  shooltz.net

So they each have a separate cpanel account and separate ip addresses, but resolve to the same document root. And I didnt edit the httpd.conf, or add any kind of special include, I made cpanel do the work.

First off.

vim /var/cpanel/userdata/proof/proof.shooltz.net

Your gonna edit the above file for the empty account that you are changing. This was done on my vps to test it and it does work (still is up if you wanna look). Below are the contents of that file before modification.

 ---
customlog:
  -
    format: combined
    target: /usr/local/apache/domlogs/proof.shooltz.net
  -
    format: "\"%{%s}t %I .\\n%{%s}t %O .\""
    target: /usr/local/apache/domlogs/proof.shooltz.net-bytes_log
documentroot: /home/proof/public_html
group: proof
hascgi: 1
homedir: /home/proof
ip: 69.16.192.68
owner: root
phpopenbasedirprotect: 1
port: 80
scriptalias:
  -
    path: /home/proof/public_html/cgi-bin
    url: /cgi-bin/
serveradmin: webmaster@proof.shooltz.net
serveralias: www.proof.shooltz.net
servername: proof.shooltz.net
usecanonicalname: 'Off'
user: proof









vim /var/cpanel/users/thecheat
/scripts/rebuildcpusers
cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak.today
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart