The question of where to store a web site on a server, for anything but the most trivial of sites, is in many ways a simple one. As this guide is mostly dedicated to virtual hosting we shall assume that for administrative convenience a separate partition, or in our example a new logical volume, will be used. The example below shows how to create a 1GB logical volume and format it with the ext3 filesystem.
As you can see from the above example we have accepted the default options when creating the filesystem. When we mount it we can use the options shown below to reduce access times by disabling recording of access times for both files and directories.
/dev/volumes/web-mad-hacking /var/www/mad-hacking ext3 noatime,nodiratime 0 2
All which then remains is to mount the new volume, using a command similar to that shown below, and populate the new filesystem with the files we wish to serve from our web site. As you can see we using a sub-directory called website so that we can easily separate CGI scripts, JavaWeb Applications, etc from other content.
The default configuration supplied by the Gentoo developers with the apache package enables name-based virtual-hosting support by default. We shall cover name-based and address-based virtual-hosting in the next two sections of this guide. For now, if all we wish to do is serve a single static web site, then we can simply modify the definition of the default virtual host as shown below.
ServerAdmin spamcatcher@hacking.co.uk
DocumentRoot "/var/www/mad-hacking/website"
<Directory "/var/www/mad-hacking/website">
Options Indexes
Order allow,deny
Allow from all
</Directory>
Once we have modified the configuration for the default virtual host we need to signal the apache daemon to reload its configuration files.
You can verify that this is working by placing a web site at the path we have just configured and pointing a web browser at the host we used for the installation.