WHM/cPanel is a web based control panel to manage complete linux system. All the cPanel accounts are created using one primary domain. This article will help you to change documentroot of primary domain of cPanel.
You must have root shell access for changing the main/primary domain document root in cPanel, Use following steps to change document root of your primary domain in cPanel account.
Step 1: Login to cPanel Server
Use SSH to get shell access for your server as root account, using your favorite ssh client. I have connected our server using PuTTY. Now edit following file.
# vim /var/cpanel/userdata/
Step 2: Update Documentroot
After editing file, search for text
Step 3: Rebuild and Restart Apache
After making changed, we need to rebuild Apache configuration file and restart Apache server. Use following command to do it.
# /scripts/rebuildhttpdconf # service httpd restart
Your changes will be permanently updated. Check your site for reflecting changes.