Document Root

The document root is the directory on a web server where the website files for a domain name are stored.

More About Document Root

Function: Serves as the base folder from which web pages are retrieved.

Configuration: Can be set or changed in the web server’s configuration or control panel.

Security Implications: Important to secure to prevent unauthorized access.

Relation to URLs: Directly corresponds to the website’s base URL.

 

How Do I Find My Website’s Document Root?

Finding your website’s Document Root depends on the web hosting environment you’re using. Here are steps for commonly used hosting platforms:

For cPanel:

  1. Log in to your cPanel account.
  2. Look for the “File Manager” or “Files” section.
  3. Open the “File Manager.”
  4. Navigate to the directory that corresponds to your website’s main domain or subdomain. The Document Root is usually named after your domain (e.g., public_html, www, or something similar).
  5. The path to your Document Root will be displayed at the top of the File Manager interface.

Learn more on How to Find the Document Root of Your Website in cPanel

For Plesk:

  1. Log in to your Plesk control panel.
  2. Go to the “Websites & Domains” section.
  3. Find your domain or subdomain, and click on it.
  4. On the domain’s overview page, you will see the Document Root path listed under “Hosting Settings.”

For Apache Servers (Without Control Panel):

If you don’t have a control panel, or if you want to find the Document Root on a server where you have direct access:

  1. Connect to your server via SSH (Secure Shell) using a terminal or an SSH client like PuTTY (for Windows users).
  2. Once connected, navigate to the Apache configuration directory. On many Linux distributions, it’s located at /etc/httpd/ or /etc/apache2/.
  3. Inside the Apache configuration directory, you’ll typically find a file named httpd.conf or apache2.conf. Open this file with a text editor.
  4. Search for a line that starts with DocumentRoot. It should look something like this:
    DocumentRoot "/var/www/html"

    The path within the double quotes is the Document Root for your server. In this example, it’s /var/www/html.

For Nginx Servers (Without Control Panel):

If you’re using Nginx as your web server:

  1. Connect to your server via SSH.
  2. Navigate to the Nginx configuration directory, which is often located at /etc/nginx/.
  3. Inside this directory, you’ll typically find a file for your site’s configuration, often located in the sites-available or conf.d directory. Open the appropriate configuration file for your site.
  4. Look for a line that begins with root. It should look something like this:
    root /var/www/html;

    The path after root is the Document Root for your Nginx server. In this example, it’s /var/www/html.

Spring into Savings!

Up to 78% Off Hosting Plans + Free Migration!

Share via