Q. How do I find out my Apache webserver document root under Linux / UNIX / BSD operating systems?
A. Apache has DocumentRoot directive.
This directive sets the directory from which Apache will serve files. Unless matched by a directive like Alias, the server appends the path from the requested URL to the document root to make the path to the document. Example:
DocumentRoot /home/www/theos.in
then an access to http://www.theos.in/index.html refers to /home/www/theos.in/index.html.
Finding Apache Document Root
Use grep command as follows:
# grep -i 'DocumentRoot' httpd.conf
RHEL / Red hat / Fedora / CentOS Linux specific command:
# grep -i 'DocumentRoot' /etc/httpd/conf/httpd.conf
FreeBSD specific command:
# grep -i 'DocumentRoot' /usr/local/etc/apache22/httpd.conf
Sample output:
# DocumentRoot: The directory out of which you will serve your DocumentRoot "/usr/local/www/apache22/data"
/usr/local/www/apache22/data is default document root for your website.
To modify DocumentRoot use vi command and change DocumentRoot:
# vi /etc/httpd/conf/httpd.conf
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop





![Apache: [warn] _default_ VirtualHost overlap on port 80, the first has precedence Error and Solution](http://s13.cyberciti.org/images/shared/rp/3/27.jpg)







{ 0 comments… add one now }