Sometimes you may need to find Document Root Folder for Apache web server. If you are wondering “where is the root directory of your website” or “where is the document root in Apache”, then here’s how to find Apache Document Root. You can use these steps to find Apache document root directory in Ubuntu, Debian, CentOS, Fedora, Redhat Linux systems.
Find Apache Document Root
Here are the steps to find Apache Document Root in Ubuntu, Debian, CentOS, Fedora, Redhat Linux systems. Apache Document Root is specified in Apache server configuration files and we will use grep command to find Apache root directory location.
Bonus Read : How to Fix 503 Service Temporarily Available
Find Apache Document Root in Ubuntu/Debian
Open terminal and run the following command to find Document Root location.
$ grep -i 'DocumentRoot' /etc/apache2/sites-available/000-default.conf DocumentRoot /var/www/html $ grep -i 'DocumentRoot' /etc/apache2/sites-available/default-ssl.conf DocumentRoot /var/www/html
If you have multiple websites (e.g site1, site2, site3) on same Apache server and want to list all Document Roots, just run the following command instead:
$ grep -i 'DocumentRoot' /etc/apache2/sites-available/*.conf /etc/apache2/sites-available/000-default.conf: DocumentRoot /var/www/html /etc/apache2/sites-available/site1.conf: DocumentRoot /var/www/html/site1/ /etc/apache2/sites-available/site2.conf: DocumentRoot /var/www/html/site2/ /etc/apache2/sites-available/site3.conf: DocumentRoot /var/www/html/site3/ /etc/apache2/sites-available/default-ssl.conf: DocumentRoot /var/www/html
Bonus Read : How to Redirect Without Changing URL
Find Apache Document Root in CentOS/Redhat/Fedora
Open terminal and run the following command to find Document Root location.
$ grep -i 'DocumentRoot' /etc/httpd/conf/httpd.conf DocumentRoot /var/www/html $ grep -i 'DocumentRoot' /etc/httpd/conf.d/ssl.conf DocumentRoot /var/www/html
If you have multiple websites (e.g site1, site2, site3) on same Apache server and want to list all Document Roots, just run the following command instead:
$ grep -i 'DocumentRoot' /etc/httpd/conf/*.conf OR $ grep -i 'DocumentRoot' /etc/httpd/conf.d/*.conf /etc/apache2/sites-available/000-default.conf: DocumentRoot /var/www/html /etc/apache2/sites-available/site1.conf: DocumentRoot /var/www/html/site1/ /etc/apache2/sites-available/site2.conf: DocumentRoot /var/www/html/site2/ /etc/apache2/sites-available/site3.conf: DocumentRoot /var/www/html/site3/ /etc/apache2/sites-available/default-ssl.conf: DocumentRoot /var/www/html
Bonus Read : How to Install mod_deflate in Apache
That’s it! Now you can easily find Apache Document Root for your websites.
Ubiq makes it easy to visualize data in minutes, and monitor in real-time dashboards. Try it Today!
Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI & software development.