> Warning: This document has not been updated to take into account changes made in the 2.0 version of the Apache HTTP Server. Some of the information may still be relevant, but please use it with care.

# Compiling and Installing Apache 1.3

This document covers compilation and installation of Apache on Unix systems only. For compiling and installation on Windows, see Using Apache with Microsoft Windows and for TPF see Installing the Apache 1.3 HTTP Server on TPF.

UnixWare users will want to consult build notes for various UnixWare versions before compiling.

## Downloading Apache

Information on the latest version of Apache can be found on the Apache web server at http://www.apache.org/. This will list the current release, any more recent beta-test release, together with details of mirror web and anonymous ftp sites.

If you downloaded a binary distribution, skip to Installing Apache. Otherwise read the next section for how to compile the server.

## Compiling Apache

Compiling Apache consists of three steps: Firstly select which Apache modules you want to include into the server. Secondly create a configuration for your operating system. Thirdly compile the executable.

All configuration of Apache is performed in the `src` directory of the Apache distribution. Change into this directory.

1. Select modules to compile into Apache in the `Configuration` file. Uncomment lines corresponding to those optional modules you wish to include (among the AddModule lines at the bottom of the file), or add new lines corresponding to additional modules you have downloaded or written. (See API.html for preliminary docs on how to write Apache modules). Advanced users can comment out some of the default modules if they are sure they will not need them (be careful though, since many of the default modules are vital for the correct operation and security of the server).

   You should also read the instructions in the `Configuration` file to see if you need to set any of the `Rule` lines.

2. Configure Apache for your operating system. Normally you can just run the `Configure` script as given below. However if this fails or you have any special requirements (e.g., to include an additional library required by an optional module) you might need to edit one or more of the following options in the `Configuration` file: `EXTRA_CFLAGS, LIBS, LDFLAGS, INCLUDES`.

   Run the `Configure` script:

   >         % Configure
   >         Using 'Configuration' as config file
   >          + configured for <whatever> platform
   >          + setting C compiler to <whatever> *
   >          + setting C compiler optimization-level to <whatever> *
   >          + Adding selected modules
   >          + doing sanity check on compiler and options
   >         Creating Makefile in support
   >         Creating Makefile in main
   >         Creating Makefile in os/unix
   >         Creating Makefile in modules/standard

   (*: Depending on Configuration and your system, Configure might not print these lines. That's OK).

   This generates a Makefile for use in stage 3. It also creates a Makefile in the support directory, for compilation of the optional support programs.

   (If you want to maintain multiple configurations, you can give an option to `Configure` to tell it to read an alternative Configuration file, such as `Configure -file Configuration.ai`).

3. Type `make`.

The modules we place in the Apache distribution are the ones we have tested and are used regularly by various members of the Apache development group. Additional modules contributed by members or third parties with specific needs or functions are available at <http://www.apache.org/dist/contrib/modules/>. There are instructions on that page for linking these modules into the core Apache code.

## Installing Apache

You will have a binary file called `httpd` in the `src` directory. A binary distribution of Apache will supply this file.

The next step is to install the program and configure it. Apache is designed to be configured and run from the same set of directories where it is compiled. If you want to run it from somewhere else, make a directory and copy the `conf`, `logs` and `icons` directories into it. In either case you should read the security tips describing how to set the permissions on the server root directory.

The next step is to edit the configuration files for the server. This consists of setting up various directives in up to three central configuration files. By default, these files are located in the `conf` directory and are called `srm.conf`, `access.conf` and `httpd.conf`. To help you get started there are same files in the `conf` directory of the distribution, called `srm.conf-dist`, `access.conf-dist` and `httpd.conf-dist`. Copy or rename these files to the names without the `-dist`. Then edit each of the files. Read the comments in each file carefully. Failure to setup these files correctly could lead to your server not working or being insecure. You should also have an additional file in the `conf` directory called `mime.types`. This file usually does not need editing.

First edit `httpd.conf`. This sets up general attributes about the server: the port number, the user it runs as, etc. Next edit the `srm.conf` file; this sets up the root of the document tree, special functions like server-parsed HTML or internal imagemap parsing, etc. Finally, edit the `access.conf` file to at least set the base cases of access.

In addition to these three files, the server behavior can be configured on a directory-by-directory basis by using `.htaccess` files in directories accessed by the server.

### Set your system time properly!

Proper operation of a public web server requires accurate time keeping, since elements of the HTTP protocol are expressed as the time of day. So, it's time to investigate setting up NTP or some other time synchronization system on your Unix box, or whatever the equivalent on NT would be.

## Compiling Support Programs

In addition to the main `httpd` server which is compiled and configured as above, Apache includes a number of support programs. These are not compiled by default. The support programs are in the `support` directory of the distribution. To compile the support programs, change into this directory and type

        make