Apache HTTP ServerCompiling and Installing Apache 1.3
This document covers compilation and installation of Apache on Unix systems. For compiling and installation on other platforms, see
Downloading ApacheYou may download the latest version of Apache either directly from the Download Page. IntroductionLike all good things, there are two ways to configure, compile, and install Apache. You can go for the 3-minute installation process using the APACI process described below; or, you can opt for the same mechanism used in previous versions of Apache, as described in the file 'src/INSTALL'. Each mechanism has its benefits and drawbacks - APACI is newer and a little more raw, but it gets you up and running the least amount of time, whereas the "Configuration.tmpl" mechanism may be more familiar and give you some more flexibility to the power user. We'd be very interested in your comments and feedback regarding each approach. Installing the Apache 1.3 HTTP server with APACIOverview for the impatient
$ ./configure --prefix=PREFIX
$ make
$ make install
$ PREFIX/bin/apachectl start
NOTE: RequirementsThe following requirements exist for building Apache:
Configuring the source treeThe next step is to configure the Apache source tree for your particular platform and personal requirements. The most important setup here is the location prefix where Apache is to be installed later, because Apache has to be configured for this location to work correctly. But there are a lot of other options available for your pleasure. For a short impression of what possibilities you have, here is a typical example which compiles Apache for the installation tree /sw/pkg/apache with a particular compiler and flags plus the two additional modules mod_rewrite and mod_proxy for later loading through the DSO mechanism:
$ CC="pgcc" OPTIM="-O2" \
./configure --prefix=/usr/local/apache \
--enable-module=rewrite --enable-shared=rewrite \
--enable-module=proxy --enable-shared=proxy
For a complete list of the available options, type the following command:
See also the file Building the packageNow you can build the various parts which form the Apache package by simply running the command
$ make
Please be patient here, this takes approximately 2 minutes to complete under a Pentium-166/FreeBSD-2.2 system, dependent on the amount of modules you have enabled. Installing the packageNow its time to install the package under the configured installation
$ make install
In the following examples, Building and installing Apache in the traditional wayBefore the advent of APACI, there was just one way to build and install Apache. While APACI gave a configuration interface which is more familiar to some people, the older method gives a way to configure the installation without typing a large number of command-line options.Configuring the installationCompiling Apache consists of three steps: First select which Apache modules you want to include into the server. Second create a configuration for your operating system. Third compile the executable.All configuration of Apache is performed in the
Compiling ApacheInstalling ApacheYou will have a binary file calledhttpd 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 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 In addition to these three files, the server behavior can be
configured on a directory-by-directory basis by using
Compiling Support ProgramsIn addition to the mainhttpd 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
Testing the packageNow you can fire up your Apache HTTP server by immediately running
$ PREFIX/bin/apachectl start
and then you should be able to request your first document via URL http://localhost/ (when you built and installed Apache as root or at least used the --without-confadjust option) or http://localhost:8080/ (when you built and installed Apache as a regular user). Then stop the server again by running:
$ PREFIX/bin/apachectl stop
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 thenet time command on NT.
Apache HTTP Server
|