Include config file for Virtual Host
I have several websites on my server (let "s call them example1.com and example2.com) Each is configured as a virtual host.
I have a specialised CMS in php which I want to make available to at least two of them. Rather than create two instances of the same set of php classes, I thought it might be better to serve these classes from the same directory which is outside their document root.
So using the CLI, I created a directory in the home directory:
/home/myprogram
which sits alongside
/home/username1
and
/home/username2
To test the idea I decided to create an apache alias, from where I could serve the material the myprogram directory
So in line with the instructions here:
Modify Apache Virtual Hosts with Include Files - EasyApache 4 - cPanel Documentation
I created the necessary directories and file for example1.com
/etc/apache2/conf.d/userdata/ssl/2_4/username1/example1.com/somename.conf
and added the following to that file:
alias /home/username1/public_html/myprogram/includes/ /home/myprogram/
Require user username1
The alias does not work. Is my approach fundamentally flawed?
Could I also ask if the rebuild process ought to automatically remove the comment before the line which would activate the Include in httpd.conf?
I'm using:
CENTOS 7.3 x86_64 standard
cPanel & WHM 64.0 (build 19)
apache 2.4
easyapache 4
I am at the edge of my skill set, so any advice would be gratefully received.
Mike
-
Rather than create two instances of the same set of php classes, I thought it might be better to serve these classes from the same directory which is outside their document root.
Hello, This is unsupported and discouraged due to the potential security risks of sharing a directory between accounts. You can find discussion of this topic on the following threads: sharing directory for users /home/scripts Share Directory Across Multiple Accounts Thank you.0 -
In that case, I'm minded to use multiple instances of the same script! 0
Please sign in to leave a comment.
Comments
2 comments