Apache (Web Server) - DocumentRoot directive

by
Jeremy Canfield |
Updated: September 28 2021
| Apache (Web Server) articles
Document root is the directory that contains the files that the web server will send to the client, such as HTML and JPG files. Typically, the web servers conf file (e.g. httpd.conf) contains the document root directive. In this example, the document root is /var/www/html.
The document root directive must not end with a trailing forward slash.
DocumentRoot "/var/www/html"
In this example, the document root directory contains a single HTML file, index.html.
~]# ls /var/www/html
index.html
Since the document root directory contains index.html, when the client navigates to www.example.com/index.html, the content of the index.html file should be displayed in the clients browser.
Did you find this article helpful?
If so, consider buying me a coffee over at