Course lectures : 1 of 1

Changing document root / home directory on the server with cPanel

Last updated: 15th December 2015

apache web serverapachedocument rootdocumentrootcpanel

Changing document root / home directory on the server with cPanel

There are situations where you might need to set up a different home / root directory for your project on the server run with cPanel. One such scenario could be some deployment tool, that pushes the code to a specific directory within the home one.

Luckily it's quite simple to achieve, but you will need root / sudo ssh access to your server.

Once you're connected to your server via ssh, navigate to the following directory:

cd /var/cpanel/userdata

If you check what's within this directory using ls, you'll see that it lists directories representing the packages on your server. Navigate to one of them (for this exercise I'll call mine ssdtutorials):

cd ssdtutorials

If you ls now, you will see that it contains several files and the one we are interested in is the one that's named after your domain - in my case it would be We need to open that file in the cli editor:


Once the file is opened, navigate to the line that says (where ssdtutorials would be the name of your account):

documentroot: /home/ssdtutorials/public_html

and change the path to point to whichever directory you'd like to use for root of this project. If you're using Envoyer, you might want to point it to something like:

documentroot: /home/ssdtutorials/public_html/current/public

Once you're done, save the changes and exit the editor (with nano that's Ctrl + x, y and Return).

All we need to do now is to rebuild and restart Apache:

service httpd restart


If you'd like to include code example please wrap your code within <pre><code> tags.

function fullName(firstName, lastName)
    return firstName + ' ' + lastName;