-->
Previous | Table of Contents | Next |
The next step in the process of setting up a server is to make some fundamental decisions regarding where on the file system different parts of the server will reside. Write down your decisions for each of these; you will need them in the next section, Performing a Basic Configuration.
The first thing you need to decide is where the server root will be. This is the subdirectory in which the server will reside and from which the conf/ directory, the logs/ and cgi-bin/ subdirectories, and other server-related directories lead. The default suggestion is to have this as /usr/local/apache although the usual server root is /pub/htdocs. You can have your configuration files and logfiles in other locations. The server root was designed to be a convenient place to keep everything server-related together. Also, if the server crashes and leaves a core file, it will be found in the server root directory.
The second decision is where the document root, the directory in which all your HTML and other media reside, will be located. A file called myfile.html in the document root would be referenced as http://host.com/index.html. This directory can be a subdirectory of the server root, or it can be outside the server root and in its own directory. Its commonly located as a subdirectory of the server root and named htdocs. If, for more disk space or other reasons, you choose to move the document root out of the server root directory, you should give it a pretty short namefor example, /home/www or /www/htdocs. If youre implementing a Web server on top of an FTP server, for example, you might want to point the document root at /home/ftp/pub.
Finally, you need to decide where on your server youll keep your logfiles. This space should have a fairly large working area, depending on how busy you estimate your server will be. For a point of reference, a site with 100K hits per day (which would fall under moderate traffic, relatively speaking) can expect to generate 15MB per day of logfile information. For performance reasons, its usually best to have the log directory on a separate disk partition or even a separate disk drive altogether, because on even a moderately busy server the access log can be written to several times per second.
This section covers the minimal set of changes you need to make to the configuration files in order to launch a basic Web site.
Apache has three separate configuration files. This model goes back to NCSA, and the reasoning is sound: There are largely three main areas of administrative configuration, so setting them up as separate files allows Webmasters to give different write permissions to each if they so desire.
Youll find the configuration files for Apache in the conf/ subdirectory of the server root directory. Each has been provided with a -dist file-name suffix; its recommended that you make a copy without the -dist and edit those new files, keeping the -dist versions as backups and reference.
The basic format of the configuration files is a combination of a shell-like interface and pseudo-HTML. The elemental unit is the directive, which can take a number of argumentsessentially,
Directive argument argument ....
that is,
Port 80
or
AddIcon /icons/back.gif ..
You can also group directives together inside certain pseudo-HTML tags. Unlike HTML, these tags should be on their own line as in the following example:
<Virtualhost www.myhost.com> DocumentRoot /www/htdocs/myhost.com ServerName www.myhost.com </Virtualhost>
NOTE: The Virtualhost directive allows a single server to pretend to be multiple servers. For example, the host specified above, www.myhost.com, doesnt have to be on a computer named www.myhost.com; it could reside on a computer named hosts.netwharf.com.
Previous | Table of Contents | Next |