Changing default home directory 'public_html'
Hello, I have read some topics here on how to change the root directory of my accounts.
I need it to be just 'public', instead of 'public_html'
I already read a topic that says to change in:
'/var/cpanel/userdata/USERNAME/DOMAIN.COM'
I did but he says after that I need rebuild the:
'/scripts/rebuildhttpdconf'
What do you mean by that?
beacuse did i change, restart apache and updated the browser and still did not change
And I wish everyone would be like this, from now on.
-
Hello @Ramon Pego First of all I want to point out that directory customization such as this is not something that cPanel supports. This means if you have issues with this customization our ability to provide assistance may be limited. To clarify those instructions you'd need to run the following: change this to what you need it to say: documentroot: /home/USERNAME/public_html
Then run the following commands:/scripts/updateuserdomains /scripts/updateuserdatacache mv /etc/apache2/conf/httpd.conf{,.bk} /scripts/rebuildhttpdconf /scripts/restartsrv_httpd
You should be able to copy/paste those in order to achieve the desired goal. Thanks!0 -
I'm very sorry for the delay, this worked great for me, i can made this change for the future created users? 0 -
Hi @Ramon Pego If you need to yes, it should be fine, though we are going to be introducing the ability to customize the homedir in a future release of cPanel/WHM 0 -
hi, i tried doing this but upon running the scripts i'm receiving errors sh /scripts/updateuserdomains /scripts/updateuserdomains: line 8: use: command not found /scripts/updateuserdomains: line 9: syntax error near unexpected token `(' /scripts/updateuserdomains: line 9: `use Cpanel::Userdomains::CORE (); 0 -
Hi @dem its probably when you edit your user domain file, you wrote something wrong, or erased some character without seeing if its possibie show us your domain config file hide your private info if needed 0 -
i really did not change that much, i only modified the documentroot path, below is the config with the domain and username omitted. --- customlog: - format: combined target: /etc/apache2/logs/domlogs/[domain] - format: "\"%{%s}t %I .\\n%{%s}t %O .\"" target: /etc/apache2/logs/domlogs/[domain]-bytes_log documentroot: /home/[username]/public_html/www/ group: [username] hascgi: 1 homedir: /home/[username] ip: [ipaddress] owner: root phpopenbasedirprotect: 1 phpversion: ea-php74 port: 8080 scriptalias: - path: /home/[username]/public_html/www/cgi-bin url: /cgi-bin/ serveradmin: webmaster@[domain] serveralias: mail.[domain] www.[domain] servername: [domain] usecanonicalname: 'Off' user: [username] 0 -
try remove the slash at the end in documentroo documentroot: /home/[username]/public_html/www/
documentroot: /home/[username]/public_html/www0 -
try remove the slash at the end in documentroo
documentroot: /home/[username]/public_html/www/
documentroot: /home/[username]/public_html/www
i tried this and it has the same error0 -
it looks like it might be something different, let's wait for someone from the staff to help you. Do not forget that when it is resolved you must make the change to '/var/cpanel/userdata/USERNAME/DOMAIN.COM_SSL'
too0 -
hi, i tried doing this but upon running the scripts i'm receiving errors sh /scripts/updateuserdomains /scripts/updateuserdomains: line 8: use: command not found /scripts/updateuserdomains: line 9: syntax error near unexpected token `(' /scripts/updateuserdomains: line 9: `use Cpanel::Userdomains::CORE ();
Why are you running this this way? You shouldn't need to use the sh command to run these. Literally just run:/scripts/updateuserdomains
as the root user.0 -
Why are you running this this way? You shouldn't need to use the sh command to run these. Literally just run:
/scripts/updateuserdomains
as the root user.
Thank you, this worked. I was thinking it was a bash file, sorry about that.0 -
btw, can i also specify a documentindex here? the problem here is my client have 2 domains pointed at the same folder but with each domain having it's own specific index file. 0 -
Hello @Ramon Pego First of all I want to point out that directory customization such as this is not something that cPanel supports. This means if you have issues with this customization our ability to provide assistance may be limited. To clarify those instructions you'd need to run the following: change this to what you need it to say:
documentroot: /home/USERNAME/public_html
Then run the following commands:/scripts/updateuserdomains /scripts/updateuserdatacache mv /etc/apache2/conf/httpd.conf{,.bk} /scripts/rebuildhttpdconf /scripts/restartsrv_httpd
You should be able to copy/paste those in order to achieve the desired goal. Thanks!
I want to a change one user's webroot directory from public_html to public. Is this still the best way to achieve this?0 -
I can't seem to see a reason to change the default directory structure. Can someone tell me why anyone would want to do this? 0 -
@vincentg : The PHP framework Laravel uses public instead of public_html for it's web-root. It used to be quite difficult to change this from within Laravel, so (for me) it was easier to change it in cPanel. 0 -
I haven't used it before but looking into it I find it is an install from Softaculous if you have it. And to make Laravel project files publicly available, you must create a symbolic link in the public_html folder that points to public folder. That would be a better way as messing with the cpanel structure may cause unknown problems. 0
Please sign in to leave a comment.
Comments
17 comments