install.html revision 7b3e47feb2f0d0a120f80b2de66656a55d0e63ef
229N/A<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
229N/A<HTML>
229N/A<HEAD>
229N/A<TITLE>Compiling and Installing Apache</TITLE>
229N/A</HEAD>
229N/A
229N/A<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
229N/A<BODY
229N/A BGCOLOR="#FFFFFF"
229N/A TEXT="#000000"
229N/A LINK="#0000FF"
229N/A VLINK="#000080"
229N/A ALINK="#FF0000"
229N/A>
229N/A<!--#include virtual="header.html" -->
229N/A
229N/A<blockquote><strong>Warning:</strong>
229N/AThis document has not been updated to take into account changes
873N/Amade in the 2.0 version of the Apache HTTP Server. Some of the
229N/Ainformation may still be relevant, but please use it
229N/Awith care.
229N/A</blockquote>
229N/A
229N/A<H1 ALIGN="CENTER">Compiling and Installing Apache 1.3</H1>
873N/A
229N/AThis document covers compilation and installation of Apache on Unix
229N/Asystems only. For compiling and installation on Windows, see <A
229N/AHREF="platform/windows.html">Using Apache with Microsoft Windows</A> and for
229N/ATPF see <A HREF="platform/install-tpf.html">Installing the Apache 1.3 HTTP
229N/AServer on TPF</A>.
229N/A
229N/A<P>
229N/A
229N/AUnixWare users will want to consult <A HREF="platform/unixware.html">build notes</A>
229N/Afor various UnixWare versions before compiling.
229N/A
229N/A<H2>Downloading Apache</H2>
229N/A
229N/AInformation on the latest version of Apache can be found on the Apache
229N/Aweb server at <A
229N/AHREF="http://www.apache.org/">http://www.apache.org/</A>. This will
229N/Alist the current release, any more recent beta-test release, together
229N/Awith details of mirror web and anonymous ftp sites.
229N/A
229N/A<P>
229N/A
229N/AIf you downloaded a binary distribution, skip to <A
229N/AHREF="#install">Installing Apache</A>. Otherwise read the next section
229N/Afor how to compile the server.
229N/A
229N/A<H2>Compiling Apache</H2>
229N/A
229N/ACompiling Apache consists of three steps: Firstly select which Apache
229N/A<STRONG>modules</STRONG> you want to include into the server. Secondly create a
232N/Aconfiguration for your operating system. Thirdly compile the
229N/Aexecutable.
229N/A<P>
229N/A
229N/AAll configuration of Apache is performed in the <CODE>src</CODE>
229N/Adirectory of the Apache distribution. Change into this directory.
229N/A
229N/A<OL>
229N/A <LI>
229N/A Select modules to compile into Apache in the
229N/A <CODE>Configuration</CODE> file. Uncomment lines corresponding to
229N/A those optional modules you wish to include (among the AddModule lines
229N/A at the bottom of the file), or add new lines corresponding to
229N/A additional modules you have downloaded or written. (See <A
229N/A HREF="misc/API.html">API.html</A> for preliminary docs on how to
229N/A write Apache modules). Advanced users can comment out some of the
229N/A default modules if they are sure they will not need them (be careful
229N/A though, since many of the default modules are vital for the correct
229N/A operation and security of the server).
229N/A <P>
229N/A
229N/A You should also read the instructions in the <CODE>Configuration</CODE>
229N/A file to see if you need to set any of the <CODE>Rule</CODE> lines.
229N/A
232N/A
229N/A <LI>
229N/A Configure Apache for your operating system. Normally you can just
229N/A run the <CODE>Configure</CODE> script as given below. However
229N/A if this fails or you have any special requirements (<EM>e.g.</EM>, to include
229N/A an additional library required by an optional module) you might need
229N/A to edit one or more of the following options in the
229N/A <CODE>Configuration</CODE> file:
229N/A <CODE>EXTRA_CFLAGS, LIBS, LDFLAGS, INCLUDES</CODE>.
229N/A <P>
229N/A
229N/A Run the <CODE>Configure</CODE> script:
229N/A <BLOCKQUOTE>
229N/A <PRE>
229N/A % Configure
229N/A Using 'Configuration' as config file
229N/A + configured for &lt;whatever&gt; platform
229N/A + setting C compiler to &lt;whatever&gt; *
229N/A + setting C compiler optimization-level to &lt;whatever&gt; *
229N/A + Adding selected modules
229N/A + doing sanity check on compiler and options
229N/A Creating Makefile in support
229N/A Creating Makefile in main
229N/A Creating Makefile in os/unix
229N/A Creating Makefile in modules/standard
229N/A </PRE>
229N/A </BLOCKQUOTE>
229N/A
229N/A (*: Depending on Configuration and your system, Configure
229N/A might not print these lines. That's OK).<P>
229N/A
229N/A This generates a Makefile for use in stage 3. It also creates a
229N/A Makefile in the support directory, for compilation of the optional
229N/A support programs.
229N/A <P>
229N/A
229N/A (If you want to maintain multiple configurations, you can give an
229N/A option to <CODE>Configure</CODE> to tell it to read an alternative
229N/A Configuration file, such as <CODE>Configure -file
229N/A Configuration.ai</CODE>).
229N/A <P>
229N/A
229N/A <LI>
229N/A Type <CODE>make</CODE>.
229N/A</OL>
229N/A
229N/AThe modules we place in the Apache distribution are the ones we have
229N/Atested and are used regularly by various members of the Apache
229N/Adevelopment group. Additional modules contributed by members or third
229N/Aparties with specific needs or functions are available at
229N/A&lt;<A HREF="http://www.apache.org/dist/contrib/modules/"
229N/A >http://www.apache.org/dist/contrib/modules/</A>&gt;.
229N/AThere are instructions on that page for linking these modules into the
229N/Acore Apache code.
229N/A
229N/A<H2><A NAME="install">Installing Apache</A></H2>
229N/A
229N/AYou will have a binary file called <CODE>httpd</CODE> in the
229N/A<CODE>src</CODE> directory. A binary distribution of Apache will
229N/Asupply this file. <P>
229N/A
229N/AThe next step is to install the program and configure it. Apache is
229N/Adesigned to be configured and run from the same set of directories
229N/Awhere it is compiled. If you want to run it from somewhere else, make
229N/Aa directory and copy the <CODE>conf</CODE>, <CODE>logs</CODE> and
229N/A<CODE>icons</CODE> directories into it. In either case you should
229N/Aread the <A HREF="misc/security_tips.html#serverroot">security tips</A>
229N/Adescribing how to set the permissions on the server root directory.<P>
229N/A
229N/AThe next step is to edit the configuration files for the server. This
229N/Aconsists of setting up various <STRONG>directives</STRONG> in up to three
229N/Acentral configuration files. By default, these files are located in
229N/Athe <CODE>conf</CODE> directory and are called <CODE>srm.conf</CODE>,
229N/A<CODE>access.conf</CODE> and <CODE>httpd.conf</CODE>. To help you get
229N/Astarted there are same files in the <CODE>conf</CODE> directory of the
229N/Adistribution, called <CODE>srm.conf-dist</CODE>,
229N/A<CODE>access.conf-dist</CODE> and <CODE>httpd.conf-dist</CODE>. Copy
229N/Aor rename these files to the names without the <CODE>-dist</CODE>.
229N/AThen edit each of the files. Read the comments in each file carefully.
229N/AFailure to setup these files correctly could lead to your server not
229N/Aworking or being insecure. You should also have an additional file in
229N/Athe <CODE>conf</CODE> directory called <CODE>mime.types</CODE>. This
229N/Afile usually does not need editing.
229N/A
229N/A<P>
229N/A
229N/AFirst edit <CODE>httpd.conf</CODE>. This sets up general attributes
229N/Aabout the server: the port number, the user it runs as, <EM>etc.</EM> Next
229N/Aedit the <CODE>srm.conf</CODE> file; this sets up the root of the
229N/Adocument tree, special functions like server-parsed HTML or internal
229N/Aimagemap parsing, <EM>etc.</EM> Finally, edit the <CODE>access.conf</CODE>
229N/Afile to at least set the base cases of access.
229N/A
229N/A<P>
229N/A
229N/AIn addition to these three files, the server behavior can be configured
229N/Aon a directory-by-directory basis by using <CODE>.htaccess</CODE>
229N/Afiles in directories accessed by the server.
229N/A
229N/A<H3>Set your system time properly!</H3>
229N/A
229N/AProper operation of a public web server requires accurate time
229N/Akeeping, since elements of the HTTP protocol are expressed as the time
229N/Aof day. So, it's time to investigate setting up NTP or some other
229N/Atime synchronization system on your Unix box, or whatever the
229N/Aequivalent on NT would be.
229N/A
232N/A<H3>Starting and Stopping the Server</H3>
229N/A
229N/ATo start the server, simply run <CODE>httpd</CODE>. This will look for
229N/A<CODE>httpd.conf</CODE> in the location compiled into the code (by
229N/Adefault <CODE>/usr/local/apache/conf/httpd.conf</CODE>). If
229N/Athis file is somewhere else, you can give the real
229N/Alocation with the -f argument. For example:
229N/A
229N/A<PRE>
229N/A /usr/local/apache/httpd -f /usr/local/apache/conf/httpd.conf
229N/A</PRE>
229N/A
229N/AIf all goes well this will return to the command prompt almost
229N/Aimmediately. This indicates that the server is now up and running. If
229N/Aanything goes wrong during the initialization of the server you will
229N/Asee an error message on the screen.
229N/A
229N/AIf the server started ok, you can now use your browser to
229N/Aconnect to the server and read the documentation. If you are running
229N/Athe browser on the same machine as the server and using the default
229N/Aport of 80, a suitable URL to enter into your browser is
229N/A
229N/A<PRE>
229N/A http://localhost/
229N/A</PRE>
229N/A
229N/A<P>
229N/A
229N/ANote that when the server starts it will create a number of
232N/A<EM>child</EM> processes to handle the requests. If you started Apache
232N/Aas the root user, the parent process will continue to run as root
229N/Awhile the children will change to the user as given in the httpd.conf
229N/Afile.
229N/A
229N/A<P>
229N/A
229N/AIf when you run <CODE>httpd</CODE> it complained about being unable to
232N/A"bind" to an address, then either some other process is already using
232N/Athe port you have configured Apache to use, or you are running httpd
229N/Aas a normal user but trying to use a port below 1024 (such as the
229N/Adefault port 80).
229N/A
229N/A<P>
229N/A
229N/AIf the server is not running, read the error message displayed
229N/Awhen you run httpd. You should also check the server
229N/Aerror_log for additional information (with the default configuration,
229N/Athis will be located in the file <CODE>error_log</CODE> in the
229N/A<CODE>logs</CODE> directory).
229N/A
229N/A<P>
232N/A
232N/AIf you want your server to continue running after a system reboot, you
229N/Ashould add a call to <CODE>httpd</CODE> to your system startup files
229N/A(typically <CODE>rc.local</CODE> or a file in an
232N/A<CODE>rc.<EM>N</EM></CODE> directory). This will start Apache as root.
229N/ABefore doing this ensure that your server is properly configured
229N/Afor security and access restrictions.
229N/A
229N/A<P>
229N/A
229N/ATo stop Apache send the parent process a TERM signal. The PID of this
229N/Aprocess is written to the file <CODE>httpd.pid</CODE> in the
229N/A<CODE>logs</CODE> directory (unless configured otherwise). Do not
229N/Aattempt to kill the child processes because they will be renewed by
229N/Athe parent. A typical command to stop the server is:
229N/A
229N/A<PRE>
229N/A kill -TERM `cat /usr/local/apache/logs/httpd.pid`
232N/A</PRE>
232N/A
232N/A<P>
229N/A
229N/AFor more information about Apache command line options, configuration
232N/Aand log files, see <A HREF="invoking.html">Starting Apache</A>. For a
229N/Areference guide to all Apache directives supported by the distributed
229N/Amodules, see the <A HREF="mod/directives.html">Apache directives</A>.
229N/A
229N/A<H2>Compiling Support Programs</H2>
229N/A
229N/AIn addition to the main <CODE>httpd</CODE> server which is compiled
229N/Aand configured as above, Apache includes a number of support programs.
232N/AThese are not compiled by default. The support programs are in the
232N/A<CODE>support</CODE> directory of the distribution. To compile
229N/Athe support programs, change into this directory and type
229N/A<PRE>
232N/A make
232N/A</PRE>
229N/A
229N/A<!--#include virtual="footer.html" -->
229N/A</BODY>
229N/A</HTML>
229N/A