Apache config for sharing domain document root

Jarod Thornton

Registered
Jun 15, 2017
3
0
1
Lexington Ky
cPanel Access Level
Root Administrator
I have searched and searched without finding any solid resource for allowing the following scenario. Any insight and feedback is appreciated.

Server

  • Apache/2.4.25
  • CENTOS 7.3 x86_64 kvm – host
  • cPanel & WHM 64.0 (build 24)
  • php 5.6
Global Configuration

  • ExecCGI *enabled
  • FollowSymLinks *enabled
  • Includes *enabled
  • IncludesNOEXEC *enabled
  • Indexes *enabled
  • MultiViews *enabled
  • SymLinksIfOwnerMatch *disabled
example.com is on ~one, but it's documentroot needs to point to ~two

This is the vhost file of one.com attempting to reference the root of ~two:
Code:
documentroot: /home/two/public_html
group: one
hascgi: 1
homedir: /home/one
ip: ##########
ipv6: ~
no_cache_update: 1
owner: owner
phpopenbasedirprotect: 1
serveralias: exmple.com mail.example.com www.example.com
servername: example.com
usecanonicalname: 'On'
user: one
userdirprotect: one
The error I get is that /home/two/public_html is not owned by ~one. Of course it's not.

How can I setup this domain to point to a different document root?
 
Last edited by a moderator:

Jarod Thornton

Registered
Jun 15, 2017
3
0
1
Lexington Ky
cPanel Access Level
Root Administrator
So we ditched the first attempt to override vhost and decided to setup the following:

  • domain1 has dedicated IP
  • domains use shared IP
  • domain2 is on it's own cpanel so client can use email etc
  • domain2 has an A record pointing to domain1 dedicated IP
This works, however I am now unable to get autossl to work with this setup. None of the common names in the certificate match the name that was entered.

How can I overcome this?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,903
2,237
463
Hello,

The issue is that it's going to load the certificate associated with the domain name on the other cPanel account, and thus not match the domain name entered in the browser. The only true way to support sharing a document root would be to have the domain names be part of the same cPanel account through the use of addon domain names.

Thank you.
 

Jarod Thornton

Registered
Jun 15, 2017
3
0
1
Lexington Ky
cPanel Access Level
Root Administrator
I understand.

So our goal is to provide our clients (if they wish) a dedicated cPanel environment for their hosting. We also offer a managed WordPress service which is on it's own dedicated cPanel account. Some clients may have multiple domains on their cPanel and want to use the managed WordPress service for one. That is what we are trying to setup. If they were on a separate host we could just create the A record to the IP for the managed WP service.

Do you have a suggestion for a solid workaround to this so we can provide this kind of split service?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,903
2,237
463