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!

Editing a DocumentRoot problem

Discussion in 'General Discussion' started by veepee, Oct 14, 2018.

  1. veepee

    veepee Registered

    Joined:
    Sep 6, 2018
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    India
    cPanel Access Level:
    Root Administrator
    I wanted to refer my php files from public_html folder in cpanel's FileManager. For this, i updated all the entries of "DocumentRoot" in httpd.conf file ( /etc/apache2/conf/httpd.conf in CentOS7 ) to /home/user/public_html but after a day it gets updated automatically back to "/var/www/html".

    This results in the php files placed under '/var/www/html' only are referred and files in 'public_html' folder in cpanel are not referred.

    What is to be done to avoid this auto update ?
     
  2. SS-Maddy

    SS-Maddy Well-Known Member

    Joined:
    Mar 28, 2009
    Messages:
    122
    Likes Received:
    13
    Trophy Points:
    68
    cPanel Access Level:
    Root Administrator
    Hello @veepee

    Your requirement is not clear for me. Can you please explain your issue more ? cPanel by default uses /home/user/public_html as its DocumentRoot for a domain hosted in a server.

    Or are you saying that you changed from /home/user/public_html to /var/www/html.

    In either case, whatever changes you make to the httpd.conf, you should edit it from WHM >> Home >> Service Configuration >> Apache Configuration
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,248
    Likes Received:
    478
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @veepee
    You cannot modify the httpd.conf directly all changes made to it will be reverted. The only way to change a domain's document root is to modify the userdata files at
    Code:
    /var/cpanel/$user/userdata
    then run the following:
    Code:
    /scripts/updateuserdomains
    /scripts/updateuserdatacache
    mv /etc/apache2/conf/httpd.conf{,.bk}
    /scripts/rebuildhttpdconf
    /scripts/restartsrv_httpd
    I want to note that while it is possible to make these customizations this is not something supported by cPanel.


    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice