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. For example:
DocumentRoot /usr/web
An access to http://www.my.host.com/index.html
now refers to /usr/web/index.html.
There appears to be a bug in 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)!
Lynx is the text browser that comes with FreeBSD and other flavors of
Unix; if it is available, type:
% lynx http://yourmachinename/
You see:
INDEX OF /
* Parent Directory
* 1.txt
If you move to 1.txt with the down arrow, you see:
hullo world
% telnet yourmachinename80
Then type:
GET / HTTP/1.0 <CR><CR>
You should see:
HTTP/1.0 200 OK
Sat, 24 Aug 1996 23:49:02 GMT
Server: Apache/1.3
Connection: close
Content-Type: text/html
<HEAD><TITLE>Index of /</TITLE></HEAD><BODY>
<H1>Index of </H1>
<UL><LI> <A HREF="/"> Parent Directory</A>
<LI> <A HREF="1.txt"> 1.txt</A>
</UL></BODY>
Connection closed by foreign host.
The stuff between the "< " and ">" is
HTML, written by Apache, which, if viewed through a browser, produces
the formatted message shown by Lynx earlier, and by Netscape in the
next chapter.