Home > Article > Operation and Maintenance > How to change the document root of your main domain in WHM/cPanel
cPanel/WHM is a web-based control panel for managing complete Linux operating systems. All cPanel accounts are created using a primary domain. This article will introduce the documentation for changing the primary domain of a cPanel user.
You must have root shell access to change the primary/primary domain document root in cPanel, please use the following steps to change the document root of the primary domain in your cPanel account Root directory.
(Recommended: Linux Video Tutorial)
Priority: Must have ssh access to the root user of the cpanel server.
Step 1: Log in to the CPanel server
Get shell access to the server as the root account using ssh, using your favorite ssh client. Connected to the server using Putty. Now edit the following files.
# vim /var/cpanel/userdata/USERNAME/DOMAINNAME.COM
Step 2: Update documentoot
After editing the file, search for the text document root and change the path as needed.
documentroot: /home/USERNAME/public_html/NEW_PATH
Step 3: Rebuild and Restart Apache
After making the changes, we need to rebuild the Apache configuration files and restart the Apache server. Use the following command to do this.
# /scripts/rebuildhttpdconf # service httpd restart
Done.
This article has ended here. For more exciting content, you can pay attention to other related column tutorials on the PHP Chinese website! !
The above is the detailed content of How to change the document root of your main domain in WHM/cPanel. For more information, please follow other related articles on the PHP Chinese website!