<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="generator" content="HTML Tidy, see www.w3.org" /> <title>Compiling and Installing Apache</title> </head> <!-- Background white, links blue (unvisited), navy (visited), red (active) --> <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#000080" alink="#FF0000"> <div align="CENTER"> <img src="images/sub.gif" alt="[APACHE DOCUMENTATION]" /> <h3>Apache HTTP Server</h3> </div> <h1 align="CENTER">Compiling and Installing Apache 1.3</h1> <p>This document covers compilation and installation of Apache on Unix systems, using the manual build and install method. If you wish to use the autoconf-style configure interface, you should instead read the INSTALL file in the root directory of the Apache source distribution. For compiling and installation on specific platforms, see</p> <ul> <li><a href="windows.html">Using Apache with Microsoft Windows</a></li> <li><a href="cygwin.html">Using Apache with Cygwin</a></li> <li><a href="netware.html">Using Apache with Novell Netware 5</a></li> <li><a href="mpeix.html">Using Apache with HP MPE/iX</a></li> <li><a href="unixware.html">Compiling Apache under UnixWare</a></li> <li><a href="readme-tpf.html">Overview of the Apache TPF Port</a></li> </ul> <h2>Downloading Apache</h2> Information on the latest version of Apache can be found on the Apache web server at <a href="http://www.apache.org/">http://www.apache.org/</a>. This will list the current release, any more recent beta-test release, together with details of mirror web and anonymous ftp sites. <p>If you downloaded a binary distribution, skip to <a href="#install">Installing Apache</a>. Otherwise read the next section for how to compile the server.</p> <h2>Compiling Apache</h2> Compiling Apache consists of three steps: Firstly select which Apache <strong>modules</strong> you want to include into the server. Secondly create a configuration for your operating system. Thirdly compile the executable. <p>All configuration of Apache is performed in the <code>src</code> directory of the Apache distribution. Change into this directory.</p> <ol> <li> Select modules to compile into Apache in the <code>Configuration</code> 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 <a href="misc/API.html">API.html</a> 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). <p>You should also read the instructions in the <code>Configuration</code> file to see if you need to set any of the <code>Rule</code> lines.</p> </li> <li> Configure Apache for your operating system. Normally you can just run the <code>Configure</code> script as given below. However if this fails or you have any special requirements (<em>e.g.</em>, to include an additional library required by an optional module) you might need to edit one or more of the following options in the <code>Configuration</code> file: <code>EXTRA_CFLAGS, LIBS, LDFLAGS, INCLUDES</code>. <p>Run the <code>Configure</code> script:</p> <blockquote> <pre> % 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 </pre> </blockquote> (*: Depending on Configuration and your system, Configure might not print these lines. That's OK). <p>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.</p> <p>(If you want to maintain multiple configurations, you can give an option to <code>Configure</code> to tell it to read an alternative Configuration file, such as <code>Configure -file Configuration.ai</code>).</p> </li> <li>Type <code>make</code>.</li> </ol> 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 <<a href="http://www.apache.org/dist/httpd/contrib/modules/">http://www.apache.org/dist/httpd/contrib/modules/</a>>. There are instructions on that page for linking these modules into the core Apache code. <h2><a id="install" name="install">Installing Apache</a></h2> You will have a binary file called <code>httpd</code> in the <code>src</code> directory. A binary distribution of Apache will supply this file. <p>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 <code>conf</code>, <code>logs</code> and <code>icons</code> directories into it. In either case you should read the <a href="misc/security_tips.html#serverroot">security tips</a> describing how to set the permissions on the server root directory.</p> <p>The next step is to edit the configuration files for the server. This consists of setting up various <strong>directives</strong> in up to three central configuration files. By default, these files are located in the <code>conf</code> directory and are called <code>srm.conf</code>, <code>access.conf</code> and <code>httpd.conf</code>. To help you get started there are same files in the <code>conf</code> directory of the distribution, called <code>srm.conf-dist</code>, <code>access.conf-dist</code> and <code>httpd.conf-dist</code>. Copy or rename these files to the names without the <code>-dist</code>. 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 <code>conf</code> directory called <code>mime.types</code>. This file usually does not need editing.</p> <p>First edit <code>httpd.conf</code>. This sets up general attributes about the server: the port number, the user it runs as, <em>etc.</em> Next edit the <code>srm.conf</code> file; this sets up the root of the document tree, special functions like server-parsed HTML or internal imagemap parsing, <em>etc.</em> Finally, edit the <code>access.conf</code> file to at least set the base cases of access.</p> <p>In addition to these three files, the server behavior can be configured on a directory-by-directory basis by using <code>.htaccess</code> files in directories accessed by the server.</p> <h3>Set your system time properly!</h3> 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. <h2>Compiling Support Programs</h2> In addition to the main <code>httpd</code> 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 <code>support</code> directory of the distribution. To compile the support programs, change into this directory and type <pre> make </pre> <hr /> <h3 align="CENTER">Apache HTTP Server</h3> <a href="./"><img src="images/index.gif" alt="Index" /></a> </body> </html>