install.html revision 35f745d0d98970c673c5ef89cd48bbd2beeb2efe
4da61833a1cbbca94094f9653fd970582b97a72etrawick<!--#include virtual="header.html" -->
4da61833a1cbbca94094f9653fd970582b97a72etrawick<P>If you wish to download and install an earlier version of Apache please
4789804be088bcd86ae637a29cdb7fda25169521jailletcread <A HREF="install_1_1.html">Compiling and Installing Apache 1.1</A>.</P>
4789804be088bcd86ae637a29cdb7fda25169521jailletcUnixWare users will want to consult <A HREF="unixware.html">build notes</A>
4789804be088bcd86ae637a29cdb7fda25169521jailletcfor various UnixWare versions before compiling.
5b88c8507d5ef6d0c4cfbc78230294968175b638minfrinInformation on the latest version of Apache can be found on the Apache
5b88c8507d5ef6d0c4cfbc78230294968175b638minfrinweb server at <A
6c3b9cebb551140fbb25d58bae08b539b3802133ylavicHREF="http://www.apache.org/">http://www.apache.org/</A>. This will
6c3b9cebb551140fbb25d58bae08b539b3802133ylaviclist the current release, any more recent beta-test release, together
6c3b9cebb551140fbb25d58bae08b539b3802133ylavicwith details of mirror web and anonymous ftp sites.
0a0df13b7f1f4f1a74fe295253d89ca3911b301aylavicIf you downloaded a binary distribution, skip to <A
0a0df13b7f1f4f1a74fe295253d89ca3911b301aylavicHREF="#install">Installing Apache</A>. Otherwise read the next section
0a0df13b7f1f4f1a74fe295253d89ca3911b301aylavicfor how to compile the server.
506bfe33206b2fece40ef25f695af39dd4130facjkaluzaCompiling Apache consists of three steps: Firstly select which Apache
506bfe33206b2fece40ef25f695af39dd4130facjkaluza<b>modules</b> you want to include into the server. Secondly create a
506bfe33206b2fece40ef25f695af39dd4130facjkaluzaconfiguration for your operating system. Thirdly compile the
d58a848a016d401b965111e50ef829e1641f7834minfrinAll configuration of Apache is performed in the <CODE>src</CODE>
2e6f4d654c96c98b761fb012fd25c5d5b1558c44sfdirectory of the Apache distribution. Change into this directory.
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic Select modules to compile into Apache in the
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic <CODE>Configuration</CODE> file. Uncomment lines corresponding to
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic those optional modules you wish to include (among the Module lines
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic at the bottom of the file), or add new lines corresponding to
e8bd80a4bb88199d2f9a24a50345688e52d9c116ylavic additional modules you have downloaded or written. (See <A
e8bd80a4bb88199d2f9a24a50345688e52d9c116ylavic HREF="misc/API.html">API.html</A> for preliminary docs on how to
e8bd80a4bb88199d2f9a24a50345688e52d9c116ylavic write Apache modules). Advanced users can comment out some of the
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic default modules if they are sure they will not need them (be careful
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic though, since many of the default modules are vital for the correct
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic operation and security of the server).
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic You should also read the instructions in the <CODE>Configuration</CODE>
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic file to see if you need to set any of the <CODE>Rule</CODE> lines.
d7205b1a86c51c27b71a2c458dc453fd53a261c1covener Configure Apache for your operating system. Normally you can just
d7205b1a86c51c27b71a2c458dc453fd53a261c1covener type run the <CODE>Configure</CODE> script as given below. However
44ff304057225e944e220e981d434a046d14cf06covener if this fails or you have any special requirements (e.g. to include
44ff304057225e944e220e981d434a046d14cf06covener an additional library required by an optional module) you might need
44ff304057225e944e220e981d434a046d14cf06covener to edit one or more of the following options in the
032982212dbcc7c3cce95bf89c503bb56e185ac7kbrand <BLOCKQUOTE>
032982212dbcc7c3cce95bf89c503bb56e185ac7kbrand % Configure
caad2986f81ab263f7af41467dd622dc9add17f3ylavic Using 'Configuration' as config file
caad2986f81ab263f7af41467dd622dc9add17f3ylavic + configured for <whatever> platform
caad2986f81ab263f7af41467dd622dc9add17f3ylavic + setting C compiler to <whatever> *
caad2986f81ab263f7af41467dd622dc9add17f3ylavic + setting C compiler optimization-level to <whatever> *
f7317ff316c2b141feea31bddb74d5d3fa1584edjorton </BLOCKQUOTE>
a34684a59b60a4173c25035d0c627ef17e6dc215rpluem (*: Depending on Configuration and your system, Configure
a34684a59b60a4173c25035d0c627ef17e6dc215rpluem make not print these lines. That's OK).<P>
1e2d421a36999d292042a5539971070d54aa6c63ylavic This generates a Makefile for use in stage 3. It also creates a
1e2d421a36999d292042a5539971070d54aa6c63ylavic Makefile in the support directory, for compilation of the optional
fa7ed98b9dc94c5845cf845aea0a44ecacd290c9humbedooh support programs.
0b67eb8568cd58bb77082703951679b42cf098actrawick (If you want to maintain multiple configurations, you can give a
0b67eb8568cd58bb77082703951679b42cf098actrawick option to <CODE>Configure</CODE> to tell it to read an alternative
0b67eb8568cd58bb77082703951679b42cf098actrawick Configuration file, such as <CODE>Configure -file
c1a63b8fad09c419c1a64f75993feb8a343a6801ylavicThe modules we place in the Apache distribution are the ones we have
c1a63b8fad09c419c1a64f75993feb8a343a6801ylavictested and are used regularly by various members of the Apache
c1a63b8fad09c419c1a64f75993feb8a343a6801ylavicdevelopment group. Additional modules contributed by members or third
e6b4bd1113567627ab6bb6c6a7105e1e01a7d889jailletcparties with specific needs or functions are available at <A
e6b4bd1113567627ab6bb6c6a7105e1e01a7d889jailletcHREF="http://www.apache.org/dist/contrib/modules/"><URL:http://www.apache.org/dist/contrib/modules/></a>.
e466c40e1801982602ee0200c9e8b61cc148742djailletcThere are instructions on that page for linking these modules into the
e466c40e1801982602ee0200c9e8b61cc148742djailletccore Apache code.
04983e3bd1754764eec7d6bb772fe3b0bf391771jortonYou will have a binary file called <CODE>httpd</CODE> in the
04983e3bd1754764eec7d6bb772fe3b0bf391771jorton<CODE>src</CODE> directory. A binary distribution of Apache will
15890c9306ba98f6fc243e15a3c4778ddc7d773erpluemsupply this file. <P>
15660979a30d251681463de2e0584853890082accovenerThe next step is to install the program and configure it. Apache is
49dacedb6c387b786b7911082ff35121a45f414bcovenerdesigned to be configured and run from the same set of directories
49dacedb6c387b786b7911082ff35121a45f414bcovenerwhere it is compiled. If you want to run it from somewhere else, make
cfd9415521847b2f9394fad04fb701cfb955f503rjunga directory and copy the <CODE>conf</CODE>, <CODE>logs</CODE> and
28c31fb73c1264bd1d0ff932573677030b024c7dwroweThe next step is to edit the configuration files for the server. This
28c31fb73c1264bd1d0ff932573677030b024c7dwroweconsists of setting up various <B>directives</B> in up to three
28c31fb73c1264bd1d0ff932573677030b024c7dwrowecentral configuration files. By default, these files are located in
28c31fb73c1264bd1d0ff932573677030b024c7dwrowethe <CODE>conf</CODE> directory and are called <CODE>srm.conf</CODE>,
28c31fb73c1264bd1d0ff932573677030b024c7dwrowe<CODE>access.conf</CODE> and <CODE>httpd.conf</CODE>. To help you get
8491e0600f69b0405e156ea8a419653c065c645bcovenerstarted there are same files in the <CODE>conf</CODE> directory of the
63b9f1f5880391261705f696d7d65507bbe9ace3covener<CODE>access.conf-dist</CODE> and <CODE>httpd.conf-dist</CODE>. Copy
63b9f1f5880391261705f696d7d65507bbe9ace3coveneror rename these files to the names without the <CODE>-dist</CODE>.
49dacedb6c387b786b7911082ff35121a45f414bcovenerThen edit each of the files. Read the comments in each file carefully.
49dacedb6c387b786b7911082ff35121a45f414bcovenerFailure to setup these files correctly could lead to your server not
49dacedb6c387b786b7911082ff35121a45f414bcovenerworking or being insecure. You should also have an additional file in
49dacedb6c387b786b7911082ff35121a45f414bcovenerthe <CODE>conf</CODE> directory called <CODE>mime.types</CODE>. This
3c990331fc6702119e4f5b8ba9eae3021aea5265jimfile usually does not need editing.
fc42512879dd0504532f52fe5d0d0383dda96a1eniqFirst edit <CODE>httpd.conf</CODE>. This sets up general attributes
fc42512879dd0504532f52fe5d0d0383dda96a1eniqabout the server: the port number, the user it runs as, etc. Next
fc42512879dd0504532f52fe5d0d0383dda96a1eniqedit the <CODE>srm.conf</CODE> file; this sets up the root of the
0451df5dc50fa5d8b3e07d92ee6a92e36a1181a5niqdocument tree, special functions like server-parsed HTML or internal
0451df5dc50fa5d8b3e07d92ee6a92e36a1181a5niqimagemap parsing, etc. Finally, edit the <CODE>access.conf</CODE>
0451df5dc50fa5d8b3e07d92ee6a92e36a1181a5niqfile to at least set the base cases of access.
da0442c0440caef34706e2c2f3af05cb65921cc0jailletcIn addition to these three files, the server behavior can be configured
06b8f183140c8e02e0974e938a05078b511d1603coveneron a directory-by-directory basis by using <CODE>.htaccess</CODE>
06b8f183140c8e02e0974e938a05078b511d1603covenerfiles in directories accessed by the server.
259878293a997ff49f5ddfc53d3739cbdc25444ecovenerTo start the server, simply run <CODE>httpd</CODE>. This will look for
259878293a997ff49f5ddfc53d3739cbdc25444ecovener<CODE>httpd.conf</CODE> in the location compiled into the code (by
259878293a997ff49f5ddfc53d3739cbdc25444ecovenerdefault <CODE>/usr/locale/etc/httpd/conf/httpd.conf</CODE>). If
15890c9306ba98f6fc243e15a3c4778ddc7d773erpluemthis file is somewhere else, you can give the real
b54b024c06a19926832d77d40ba35ad8c41e4d3dminfrinlocation with the -f argument. For example:
65967d05f839dbf27cf91d91fa79585eeae19660minfrin /usr/local/etc/apache/src/httpd -f /usr/local/etc/apache/conf/httpd.conf
65967d05f839dbf27cf91d91fa79585eeae19660minfrinIf all goes well this will return to the command prompt almost
8152945ae46857b170cb227e79bb799f4fc7710dminfrinimmediately. This indicates that the server is now up and running. If
8152945ae46857b170cb227e79bb799f4fc7710dminfrinanything goes wrong during the initialization of the server you will
8152945ae46857b170cb227e79bb799f4fc7710dminfrinsee an error message on the screen.
75f5c2db254c0167a0e396254460de09b775d203trawickIf the server started ok, you can now use your browser to
75f5c2db254c0167a0e396254460de09b775d203trawickconnect to the server and read the documentation. If you are running
75f5c2db254c0167a0e396254460de09b775d203trawickthe browser on the same machine as the server and using the default
4f0358189bfa57b8e75bd6b94db264302a8f336amrumphport of 80, a suitable URL to enter into your browser is
54d750a84a175d8e338880514d440773eb986b50covenerNote that when the server starts it will create a number of
54d750a84a175d8e338880514d440773eb986b50covener<i>child</i> processes to handle the requests. If you started Apache
54d750a84a175d8e338880514d440773eb986b50coveneras the root user, the parent process will continue to run as root
54d750a84a175d8e338880514d440773eb986b50covenerwhile the children will change to the user as given in the httpd.conf
54d750a84a175d8e338880514d440773eb986b50covenerIf when you run <CODE>httpd</CODE> it complained about being unable to
54d750a84a175d8e338880514d440773eb986b50covener"bind" to an address, then either some other process is already using
83b50288fa7d306324bba68832011ea08f5c7832covenerthe port you have configured Apache to use, or you are running httpd
4e30ef014533a7e93c92d88306291f5e49c9692ftrawickas a normal user but trying to use port below 1024 (such as the
83b50288fa7d306324bba68832011ea08f5c7832covenerdefault port 80).
2e15620d724fb8e3a5be183b917359a2fd6e9468covenerIf the server is not running, read the error message displayed
2e15620d724fb8e3a5be183b917359a2fd6e9468covenerwhen you run httpd. You should also check the server
2e15620d724fb8e3a5be183b917359a2fd6e9468covenererror_log for additional information (with the default configuration,
2e15620d724fb8e3a5be183b917359a2fd6e9468covenerthis will be located in the file <CODE>error_log</CODE> in the
b8efdc95bec9cf089aa1be0bfd07d46aa1137a7acovenerIf you want your server to continue running after a system reboot, you
b8efdc95bec9cf089aa1be0bfd07d46aa1137a7acovenershould add a call to <CODE>httpd</CODE> to your system startup files
f06e7c4b1bce6b6491e5de0b7998d3f5696b293dchrisd<CODE>rc.<I>N</I></CODE> directory). This will start Apache as root.
f06e7c4b1bce6b6491e5de0b7998d3f5696b293dchrisdBefore doing this ensure that your server is properly configured
f06e7c4b1bce6b6491e5de0b7998d3f5696b293dchrisdfor security and access restrictions.
111436a32ba1254291e4883292fb116d15fe8f64covenerTo stop Apache send the parent process a TERM signal. The PID of this
fce4949fb0b309a5744afcd503c6ed2d35621ee2covenerprocess is written to the file <CODE>httpd.pid</CODE> in the
fce4949fb0b309a5744afcd503c6ed2d35621ee2covener<CODE>logs</CODE> directory (unless configured otherwise). Do not
fce4949fb0b309a5744afcd503c6ed2d35621ee2covenerattempt to kill the child processes because they will be renewed by
fce4949fb0b309a5744afcd503c6ed2d35621ee2covenerthe parent. A typical command to stop the server is:
7b7430e701e9a31ce809da7c220bb8dfcf68c86etrawick kill -TERM `cat /usr/local/etc/apache/logs/httpd.pid`
273e512f20f262e5e2aa8e0e83371d1929fb76adjkaluzaFor more information about Apache command line options, configuration
273e512f20f262e5e2aa8e0e83371d1929fb76adjkaluzaand log files, see <A HREF="invoking.html">Starting Apache</A>. For a
efe780dcf13b2b95effabf897d694d8f23feac74trawickreference guide to all Apache directives supported by the distributed
fe83f60b41477b14a37edcfcd1f7f5c5a1ebfe44minfrinmodules, see the <A HREF="mod/directives.html">Apache directives</A>.
993d1261a278d7322bccef219101220b7b4fb8c5jkaluzaIn addition to the main <CODE>httpd</CODE> server which is compiled
993d1261a278d7322bccef219101220b7b4fb8c5jkaluzaand configured as above, Apache includes a number of support programs.
ba050a6f942b9fa0e81ed73437588005c569655ccovenerThese are not compiled by default. The support programs are in the
ba050a6f942b9fa0e81ed73437588005c569655ccovener<CODE>support</CODE> directory of the distribution. To compile
ba050a6f942b9fa0e81ed73437588005c569655ccovenerthe support programs, change into this directory and type
001a44c352f89c9ec332ffd3e0a6927dcd19432chumbedooh<!--#include virtual="footer.html" -->