2 domains 1 documentroot: Difference between revisions

From Cheatsheet
Jump to navigation Jump to search
No edit summary
m 5 revisions
 
(3 intermediate revisions by 2 users not shown)
Line 23: Line 23:
     format: "\"%{%s}t %I .\\n%{%s}t %O .\""
     format: "\"%{%s}t %I .\\n%{%s}t %O .\""
     target: /usr/local/apache/domlogs/proof.shooltz.net-bytes_log
     target: /usr/local/apache/domlogs/proof.shooltz.net-bytes_log
  documentroot: /home/<font color=red>proof/</font>public_html
  documentroot: /home/<font color=red>proof</font>/public_html
  group: <font color=red>proof</font>
  group: <font color=red>proof</font>
  hascgi: 1
  hascgi: 1
Line 41: Line 41:
  user: <font color=red>proof</font>
  user: <font color=red>proof</font>


Alright the sections that are highlighted in green are what we will be changing in this file.  We are going to change all of these to the username of the account which has all of the content and the document root that we are going to use, which in this case will be shooltz.


  ---
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/<font color=green>shooltz</font>/public_html
group: <font color=green>shooltz</font>
hascgi: 1
homedir: /home/proof
ip: 69.16.192.68
owner: root
phpopenbasedirprotect: 1
port: 80
scriptalias:
  -
    path: /home/<font color=green>shooltz</font>/public_html/cgi-bin
    url: /cgi-bin/
serveradmin: webmaster@proof.shooltz.net
serveralias: www.proof.shooltz.net
servername: proof.shooltz.net
usecanonicalname: 'Off'
user: <font color=green>shooltz</font>


Alright now that, this part has been completed save this and load the next file.


<font color=red></font>
vim /var/cpanel/users/proof
 
 
 
 
 
 
 


Once in this file change the one highlighted line below.


# cPanel -- If you edit this file directly you must run /scripts/updateuserdomains afterwards to rebuild the system caches
BWLIMIT=unlimited
CONTACTEMAIL=mike@shooltz.net
CONTACTEMAIL2=
DEMO=0
DNS=proof.shooltz.net
FEATURELIST=default
HASCGI=1
IP=69.16.192.68
LOCALE=en
MAXADDON=0
MAXFTP=unlimited
MAXLST=unlimited
MAXPARK=0
MAXPOP=unlimited
MAXSQL=unlimited
MAXSUB=unlimited
MTIME=1292231664
MXCHECK-proof.shooltz.net=0
OWNER=root
PLAN=default
RS=x3
STARTDATE=1292231663
USER=<font color=red>proof</font>  (changing this to <font color=green>shooltz</font>)


Now once that has been completed there are only a couple more things to do.


 
  /scripts/updateuserdomains
vim /var/cpanel/users/thecheat
  cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak.before.duplicate.documentroot
  /scripts/rebuildcpusers
  cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak.today
  /scripts/rebuildhttpdconf
  /scripts/rebuildhttpdconf
  /etc/init.d/httpd restart
  /etc/init.d/httpd restart
Now you should be able to visit <font color=red>http://proof.shooltz.net</font> and it will have its own ip and have the exact same content as <font color=green>http://shooltz.net</font> which is also on a different ip.  And you can install a differtent SSL cert on both.

Latest revision as of 23:51, 23 October 2014

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

Alright the sections that are highlighted in green are what we will be changing in this file. We are going to change all of these to the username of the account which has all of the content and the document root that we are going to use, which in this case will be shooltz.

 ---
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/shooltz/public_html
group: shooltz
hascgi: 1
homedir: /home/proof
ip: 69.16.192.68
owner: root
phpopenbasedirprotect: 1
port: 80
scriptalias:
  -
    path: /home/shooltz/public_html/cgi-bin
    url: /cgi-bin/
serveradmin: webmaster@proof.shooltz.net
serveralias: www.proof.shooltz.net
servername: proof.shooltz.net
usecanonicalname: 'Off'
user: shooltz

Alright now that, this part has been completed save this and load the next file.

vim /var/cpanel/users/proof

Once in this file change the one highlighted line below.

# cPanel -- If you edit this file directly you must run /scripts/updateuserdomains afterwards to rebuild the system caches
BWLIMIT=unlimited
CONTACTEMAIL=mike@shooltz.net
CONTACTEMAIL2=
DEMO=0
DNS=proof.shooltz.net
FEATURELIST=default
HASCGI=1
IP=69.16.192.68
LOCALE=en
MAXADDON=0
MAXFTP=unlimited
MAXLST=unlimited
MAXPARK=0
MAXPOP=unlimited
MAXSQL=unlimited
MAXSUB=unlimited
MTIME=1292231664
MXCHECK-proof.shooltz.net=0
OWNER=root
PLAN=default
RS=x3
STARTDATE=1292231663
USER=proof  (changing this to shooltz)

Now once that has been completed there are only a couple more things to do.

/scripts/updateuserdomains
cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak.before.duplicate.documentroot
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart

Now you should be able to visit http://proof.shooltz.net and it will have its own ip and have the exact same content as http://shooltz.net which is also on a different ip. And you can install a differtent SSL cert on both.