Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Include config file for Virtual Host

Discussion in 'General Discussion' started by Michael Workman, May 8, 2017.

  1. Michael Workman

    Michael Workman Registered

    Joined:
    May 8, 2017
    Messages:
    2
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    UK/Spain
    cPanel Access Level:
    Root Administrator
    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:

    <IfModule alias_module>

    alias /home/username1/public_html/myprogram/includes/ /home/myprogram/

    <Directory "/home/myprogram/">

    Require user username1

    </Directory>

    </IfModule>



    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
     
    #1 Michael Workman, May 8, 2017
    Last edited by a moderator: May 8, 2017
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
  3. Michael Workman

    Michael Workman Registered

    Joined:
    May 8, 2017
    Messages:
    2
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    UK/Spain
    cPanel Access Level:
    Root Administrator
    In that case, I'm minded to use multiple instances of the same script!
     
    cPanelMichael likes this.
Loading...

Share This Page