How to Find Apache Document Root in CentOS


This article provides a guide for how to find Apache Document Root in CentOS server. 

What is Document Root?

The DocumentRoot is the top-level directory in the document tree visible from the web. This directive sets the directory in the configuration from which Apache2 or HTTPD looks for and serves web files.

For example:

DocumentRoot "/var/www/html"

Finding Apache Document Root in CentOS

Follow the steps below to locate the Apache Document Root of CentOS server.

  1. Login to your CentOS server via SSH
  2. Run the following commands:
    grep -i 'DocumentRoot' /etc/httpd/conf/httpd.conf
    grep -i 'DocumentRoot' /etc/httpd/conf.d/ssl.conf
  3. Find Location of Document Root in response:

How to find Apache Document Root in CentOS

# DocumentRoot: The directory out of which you will serve your DocumentRoot "/var/www/html"

From this we can determine the Document Root is located at /var/www/html

RELATED: How to Change Document Root Location

  • document root, apache, centos
  • 3 Users Found This Useful
這篇文章有幫助嗎?

Related Articles

View Server PHP Environment with phpinfo.php

The phpinfo() function outputs a huge amount of information about the system you're using, such...

How to Change Root Password Using SSH

This article explains the method of changing the root password on a Linux Server using SSH....

How to Create Sudo User on CentOS

This article provides step-by-step setup guide for adding Sudo user to CentOS system. The sudo...

How to Use Sudo

This article provides a guide to using a Sudo user on CentOS server. From the command line,...

Set Server Time Zones with Timedatectl

This article provides a guide to setting the server time and server time zone settings using...