Apache File Layout


After installing Apache, you'll notice that a new directory has been created in /usr/local for the server's root directory. This new directory, /usr/local/www, contains several subdirectories for various purposes, some of which are symbolic links. The map of Apache's file layout is shown in Figure 26.1. As you would expect, everything installed as part of Apache is underneath /usr/local, except for log files (which go into /var/log with all the rest of the system's log files).

Figure 26.1. Map of the Apache file layout, showing the relationship of config files, the server document root, and support binaries.


Actually, a few of these directories are in a temporary, installation-only file structure that prevents the install script from "clobbering" existing files on a live server. For instance, /usr/local/www/data is the location where the default configuration expects to find the document root; however, this location is a symlink to /usr/local/www/data-dist, and it contains only generic HTML files in a variety of language variants that, if left unchanged, will tell a visitor to your site merely that Apache has been installed correctly. Your first step after installing Apache from the ports or packages should be to remove the symbolic link (rm/usr/local/www/data) and replace it with a regular directory (mkdir /usr/local/www/data) into which you will later put your web content. (One precaution, common to sites that use virtual hosts, is to keep your web content in a completely different location and change the ServerRoot directive accordingly.) Similarly, /usr/local/www/cgi-bin is a symlink to /usr/local/www/cgi-bin-dist, itself a regular directory. If you put files into cgi-bin, they will actually go into the cgi-bin-dist directory, unless you change cgi-bin to be its own regular directory. Making these changes ensures that even if you deinstall the Apache package, your data directory and its contents will be left untouched.

The configuration files in /usr/local/etc/apache, which we will discuss in a moment, also have -dist or -std variantsthere are no symbolic links here, but the -dist files are the only ones that are touched when you reinstall or upgrade. This gives you a "safety net" and reference file in case you change something in your live configuration files that you can't fix without hints.

As with Sendmail, Apache's file layout in FreeBSD is considerably different from the layout in an Apache installation on other platforms. Each one differs slightly, so knowing the FreeBSD layout well won't necessarily help you if you have to maintain Apache on Linux, Solaris, or Windows.

Here's one tip that may help: There's usually a "server root" directory, such as /usr/local/www on FreeBSD, in which everything Apache-related lives. On Linux, this is often in /var/lib/apache; however, in this style of installation, very nearly everything associated with Apacheincluding config files, binaries, logs, sources, and build configuration scriptslives in or under that one directory. Although this doesn't have the benefit of FreeBSD's rigid and consistent structure, at least you'll be able to find just about everything in one place in such an installation.




FreeBSD 6 Unleashed
FreeBSD 6 Unleashed
ISBN: 0672328755
EAN: 2147483647
Year: 2006
Pages: 355
Authors: Brian Tiemann

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net