Two sites sharing the same application

Overflow

Registered
Nov 2, 2014
4
0
1
cPanel Access Level
Root Administrator
Hello,

We just started using WHM where I work and we love it.

However, we have a question regarding the hosting of two sites, with two different IPs, sharing the same application.

For example:

a.domain1.com
b.domain2.com

They are running the same web application. We are maintaining only one version of the application, so each website should use the same sources. However, they both have a dedicated IP address, so they can have their own SSL and reputation.

The question is: how can we share the same sources on the same server? The application is developped in PHP.

We tried creating a symlink between the two accounts, but it does not work because of the permissions.

How can this situation be handled in WHM? We know we could simply add an Alias and the IP address directly in the apache configuration, but it seems this configuration is overwritten at some point.

Thank you!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
However, they both have a dedicated IP address, so they can have their own SSL and reputation.
This is no longer the case if you are using an OS that supports SNI (CentOS/RHEL/Cloud Linux 6 or higher). You should add one of these domain names as an addon domain to the other so they can utilize the same file paths. Note that you can also assign dedicated IP addresses to addon domain names using the instructions here:

Dedicated IP Address for Addon Domains

Thank you.
 

Overflow

Registered
Nov 2, 2014
4
0
1
cPanel Access Level
Root Administrator
Thank you!

I finally created a custom VirtualHost before your answer in : /usr/local/apache/conf/includes/post_virtualhost_global.conf

I will definitely try your way.