1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
4 <TITLE>Compiling and Installing Apache</TITLE>
7 <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
15 <!--#include virtual="header.html" -->
17 <blockquote><strong>Warning:</strong>
18 This document has not been updated to take into account changes
19 made in the 2.0 version of the Apache HTTP Server. Some of the
20 information may still be relevant, but please use it
24 <H1 ALIGN="CENTER">Compiling and Installing Apache 1.3</H1>
26 This document covers compilation and installation of Apache on Unix
27 systems only. For compiling and installation on Windows, see <A
28 HREF="platform/windows.html">Using Apache with Microsoft Windows</A> and for
29 TPF see <A HREF="platform/install-tpf.html">Installing the Apache 1.3 HTTP
34 UnixWare users will want to consult <A HREF="platform/unixware.html">build notes</A>
35 for various UnixWare versions before compiling.
37 <H2>Downloading Apache</H2>
39 Information on the latest version of Apache can be found on the Apache
41 HREF="http://www.apache.org/">http://www.apache.org/</A>. This will
42 list the current release, any more recent beta-test release, together
43 with details of mirror web and anonymous ftp sites.
47 If you downloaded a binary distribution, skip to <A
48 HREF="#install">Installing Apache</A>. Otherwise read the next section
49 for how to compile the server.
51 <H2>Compiling Apache</H2>
53 Compiling Apache consists of three steps: Firstly select which Apache
54 <STRONG>modules</STRONG> you want to include into the server. Secondly create a
55 configuration for your operating system. Thirdly compile the
59 All configuration of Apache is performed in the <CODE>src</CODE>
60 directory of the Apache distribution. Change into this directory.
64 Select modules to compile into Apache in the
65 <CODE>Configuration</CODE> file. Uncomment lines corresponding to
66 those optional modules you wish to include (among the AddModule lines
67 at the bottom of the file), or add new lines corresponding to
68 additional modules you have downloaded or written. (See <A
69 HREF="misc/API.html">API.html</A> for preliminary docs on how to
70 write Apache modules). Advanced users can comment out some of the
71 default modules if they are sure they will not need them (be careful
72 though, since many of the default modules are vital for the correct
73 operation and security of the server).
76 You should also read the instructions in the <CODE>Configuration</CODE>
77 file to see if you need to set any of the <CODE>Rule</CODE> lines.
81 Configure Apache for your operating system. Normally you can just
82 run the <CODE>Configure</CODE> script as given below. However
83 if this fails or you have any special requirements (<EM>e.g.</EM>, to include
84 an additional library required by an optional module) you might need
85 to edit one or more of the following options in the
86 <CODE>Configuration</CODE> file:
87 <CODE>EXTRA_CFLAGS, LIBS, LDFLAGS, INCLUDES</CODE>.
90 Run the <CODE>Configure</CODE> script:
94 Using 'Configuration' as config file
95 + configured for <whatever> platform
96 + setting C compiler to <whatever> *
97 + setting C compiler optimization-level to <whatever> *
98 + Adding selected modules
99 + doing sanity check on compiler and options
100 Creating Makefile in support
101 Creating Makefile in main
102 Creating Makefile in os/unix
103 Creating Makefile in modules/standard
107 (*: Depending on Configuration and your system, Configure
108 might not print these lines. That's OK).<P>
110 This generates a Makefile for use in stage 3. It also creates a
111 Makefile in the support directory, for compilation of the optional
115 (If you want to maintain multiple configurations, you can give an
116 option to <CODE>Configure</CODE> to tell it to read an alternative
117 Configuration file, such as <CODE>Configure -file
118 Configuration.ai</CODE>).
122 Type <CODE>make</CODE>.
125 The modules we place in the Apache distribution are the ones we have
126 tested and are used regularly by various members of the Apache
127 development group. Additional modules contributed by members or third
128 parties with specific needs or functions are available at
129 <<A HREF="http://www.apache.org/dist/contrib/modules/"
130 >http://www.apache.org/dist/contrib/modules/</A>>.
131 There are instructions on that page for linking these modules into the
134 <H2><A NAME="install">Installing Apache</A></H2>
136 You will have a binary file called <CODE>httpd</CODE> in the
137 <CODE>src</CODE> directory. A binary distribution of Apache will
138 supply this file. <P>
140 The next step is to install the program and configure it. Apache is
141 designed to be configured and run from the same set of directories
142 where it is compiled. If you want to run it from somewhere else, make
143 a directory and copy the <CODE>conf</CODE>, <CODE>logs</CODE> and
144 <CODE>icons</CODE> directories into it. In either case you should
145 read the <A HREF="misc/security_tips.html#serverroot">security tips</A>
146 describing how to set the permissions on the server root directory.<P>
148 The next step is to edit the configuration files for the server. This
149 consists of setting up various <STRONG>directives</STRONG> in up to three
150 central configuration files. By default, these files are located in
151 the <CODE>conf</CODE> directory and are called <CODE>srm.conf</CODE>,
152 <CODE>access.conf</CODE> and <CODE>httpd.conf</CODE>. To help you get
153 started there are same files in the <CODE>conf</CODE> directory of the
154 distribution, called <CODE>srm.conf-dist</CODE>,
155 <CODE>access.conf-dist</CODE> and <CODE>httpd.conf-dist</CODE>. Copy
156 or rename these files to the names without the <CODE>-dist</CODE>.
157 Then edit each of the files. Read the comments in each file carefully.
158 Failure to setup these files correctly could lead to your server not
159 working or being insecure. You should also have an additional file in
160 the <CODE>conf</CODE> directory called <CODE>mime.types</CODE>. This
161 file usually does not need editing.
165 First edit <CODE>httpd.conf</CODE>. This sets up general attributes
166 about the server: the port number, the user it runs as, <EM>etc.</EM> Next
167 edit the <CODE>srm.conf</CODE> file; this sets up the root of the
168 document tree, special functions like server-parsed HTML or internal
169 imagemap parsing, <EM>etc.</EM> Finally, edit the <CODE>access.conf</CODE>
170 file to at least set the base cases of access.
174 In addition to these three files, the server behavior can be configured
175 on a directory-by-directory basis by using <CODE>.htaccess</CODE>
176 files in directories accessed by the server.
178 <H3>Set your system time properly!</H3>
180 Proper operation of a public web server requires accurate time
181 keeping, since elements of the HTTP protocol are expressed as the time
182 of day. So, it's time to investigate setting up NTP or some other
183 time synchronization system on your Unix box, or whatever the
184 equivalent on NT would be.
186 <H2>Compiling Support Programs</H2>
188 In addition to the main <CODE>httpd</CODE> server which is compiled
189 and configured as above, Apache includes a number of support programs.
190 These are not compiled by default. The support programs are in the
191 <CODE>support</CODE> directory of the distribution. To compile
192 the support programs, change into this directory and type
197 <!--#include virtual="footer.html" -->