DocumentRoot
This directive sets the directory from which Apache will serve files.
DocumentRoot directory
Default: /usr/local/apache/htdocs
Server config, virtual hostUnless 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. For example:
DocumentRoot /usr/web
An access to http://www.www.my.host.com/index.html now refers to /usr/web/index.html.
There appears to be a bug in the relevant Module,
mod_dir, that causes problems when the directory
specified in DocumentRoot has a trailing slash
(e.g., DocumentRoot
/usr/web/),
so please avoid that. It is worth bearing in mind that the deeper
DocumentRoot goes, the longer it takes Apache to
check out the directories. For the sake of performance, adopt the
British Army’s universal motto: KISS (Keep It
Simple, Stupid)!
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access