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.

DocumentRoot and httpd.conf

Discussion in 'EasyApache' started by fk77388, Aug 25, 2013.

  1. fk77388

    fk77388 Registered

    Joined:
    Aug 22, 2013
    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    I have a server with multiple IP addresses. I am installing multiple domains to run from one code base, so I am defining the same document root. Each domain with it's own IP.

    When I add the following (for each domain name/IP pair) in the pre_virtualhost_global.conf section in Service Configuration » Apache Configuration » Include Editor:
    Code:
    <VirtualHost 1.2.3.4:80>
        ServerName example.com
        ServerAlias *.example.com
        DocumentRoot /installdir/ofonecodebase
    </VirtualHost>
    The result in httpd.conf virtual hosts section of DocumentRoot comes out /pathto/defineddocroot/username/public_html
    How can I force generating httpd.conf with the DocumentRoot I defined - without username ...

    There is no one document that lists file names and sequence used in generating httpd.conf and some threads say that cPanel preferred method is to use the include editor.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    You can modify the document root for a domain name by editing the "documentroot" entry in the appropriate cPanel user data file:

    Code:
    /var/cpanel/userdata/$username/$domain.com
    Then, rebuild the Apache configuration file via:

    Code:
    /scripts/rebuildhttpdconf
    Thank you.
     
  3. fk77388

    fk77388 Registered

    Joined:
    Aug 22, 2013
    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Re: DocumentRoot and htttpd.conf [Resolved]


    Thank you Michael, it worked. :)
    Just in case someone else run into same issues, I am documenting procedure I followed below.

    After making changes to files above. I ran into another problem with php's open_basedir in httpd.conf, it was pointing to the old user's home directory for each domain respectively. To resolve:

    1- copy /var/cpanel/templates/apache2_4/vhost.default to /var/cpanel/templates/apache2_4/vhost.local
    note: your directory may say apache2_2 or apache2, I am running ver. 2.4

    2- edit vhost.local, the section that begins with:
    Code:
    [% IF phpopenbasedirprotect_enabled && vhost.phpopenbasedirprotect && ( supported.libphp4 || supported.libphp5 ) -%]
    and ending with
    Code:
    [%- END %]
    Replace every instance of vhost.homedir to vhost.documentroot

    3- save file and run the following:
    Code:
    /usr/local/cpanel/bin/apache_conf_distiller --update
    /usr/local/cpanel/bin/build_apache_conf
    service httpd restart 
    ******************************************************************************
    Run multiple domains from one code base Wordpress / Drupal / Joomla.

    Configure vhosts file and httpd.conf to run multiple domains from same code base Wordpress / Drupal / Joomla
     
    #3 fk77388, Aug 26, 2013
    Last edited: Aug 26, 2013
    MaxFein likes this.
Loading...

Share This Page