Jun 21, 2016
10
0
1
Brazil
cPanel Access Level
Root Administrator
Changing DocumentRoot of all sites and leave as default DocumentRoot below:

/public_html

to

/public_html/www

www is DocumentRoot of all sites.

My apache server is 2.4, tutorials here forums cpanel not working.
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
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
You will need to develop a script that completes this action for all accounts, and runs automatically when new accounts are created, if you prefer to automate this functionality.

Thank you.
 
Jun 21, 2016
10
0
1
Brazil
cPanel Access Level
Root Administrator
I believe you do not understand, let's go.

In my hosting use mainly laravel, and would leave already configured that each account created apache make reading the DocumentRoot in public_html/www

Would it automatically, every account created a template for this was generated.

I have changed the /root/ cpanel3-skel/public_html to automatically create the www folder and with the necessary access, could understand?

Thank you very much.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
  • Like
Reactions: danielpmc

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
I'm happy to see that information was helpful. Thank you for updating us with the outcome.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
why don't build it default from cPanel installation, so we don't need more costumize...
sigh....
Hello @hrace009,

We do have a feature request opened to allow users to update the document root for the primary domain name associated with the account through cPanel:

Allow users to change the DocumentRoot

I encourage you to open a new feature request if you'd like to see the ability for administrators to change the default document root for new accounts via an option in Web Host Manager:

Submit A Feature Request

Thank you.