By jitwix67
I went to WHM Terminal and trying to change root of “public_html” by this code “/var/cpanel/userdata/username/domain.com” it showing permission denied, So how I can solve this issue ?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
As you may know, directly modifying the Apache config on a cPanel server is not a good idea as your changes would be lost after the next Apache rebuild.
Also changing the document root for an Addon domain name on a cPanel server is pretty straightforward. However, occasionally you would like to do this for your main domain name as well.
Here’s one of the easy ways on how to do that:
You would need root shell access and then follow these simple steps:
Open the following file:
nano /var/cpanel/userdata/your-cpanel-user/your-domain.com
Modify the documentroot accordingly:
documentroot: /home/your-cpanel-user/public
Then rebuild your Apache config file
/scripts/rebuildhttpdconf
Run a config test
apachectl -t
If you get Syntax OK, then restart Apache:
systemctl restart httpd
Hope that it helps. Regards, Bobby Source
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.