Editing a DocumentRoot problem
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 ?
-
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 0 -
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 /var/cpanel/$user/userdata
then run the following:/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!0
Please sign in to leave a comment.
Comments
2 comments