DocumentRoot
This directive sets the directory from which Apache will serve files.
DocumentRoot directory
Default: /usr/local/apache/htdocs
Server config, virtual host
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. 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)!
Get Apache: The Definitive Guide, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.