]> granicus.if.org Git - apache/blob - docs/manual/install.html.en
Update sample output from Configure to something more like what it
[apache] / docs / manual / install.html.en
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>Compiling and Installing Apache</TITLE>
5 </HEAD>
6
7 <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
8 <BODY
9  BGCOLOR="#FFFFFF"
10  TEXT="#000000"
11  LINK="#0000FF"
12  VLINK="#000080"
13  ALINK="#FF0000"
14 >
15 <!--#include virtual="header.html" -->
16
17 <H1 ALIGN="CENTER">Compiling and Installing Apache 1.2</H1>
18
19 <P>If you wish to download and install an earlier version of Apache please
20 read <A HREF="install_1_1.html">Compiling and Installing Apache 1.1</A>.</P>
21
22 UnixWare users will want to consult <A HREF="unixware.html">build notes</A>
23 for various UnixWare versions before compiling.
24
25 <H2>Downloading Apache</H2>
26
27 Information on the latest version of Apache can be found on the Apache
28 web server at <A
29 HREF="http://www.apache.org/">http://www.apache.org/</A>.  This will
30 list the current release, any more recent beta-test release, together
31 with details of mirror web and anonymous ftp sites.
32
33 <P>
34
35 If you downloaded a binary distribution, skip to <A
36 HREF="#install">Installing Apache</A>. Otherwise read the next section
37 for how to compile the server.
38
39 <h2>Compiling Apache</h2>
40
41 Compiling Apache consists of three steps: Firstly select which Apache
42 <b>modules</b> you want to include into the server. Secondly create a
43 configuration for your operating system. Thirdly compile the
44 executable.
45 <P>
46
47 All configuration of Apache is performed in the <CODE>src</CODE>
48 directory of the Apache distribution. Change into this directory.
49
50 <OL>
51  <LI>
52   Select modules to compile into Apache in the
53   <CODE>Configuration</CODE> file. Uncomment lines corresponding to
54   those optional modules you wish to include (among the AddModule lines
55   at the bottom of the file), or add new lines corresponding to
56   additional modules you have downloaded or written. (See <A
57   HREF="misc/API.html">API.html</A> for preliminary docs on how to
58   write Apache modules).  Advanced users can comment out some of the
59   default modules if they are sure they will not need them (be careful
60   though, since many of the default modules are vital for the correct
61   operation and security of the server).
62   <P>
63
64   You should also read the instructions in the <CODE>Configuration</CODE>
65   file to see if you need to set any of the <CODE>Rule</CODE> lines.
66
67
68  <LI>
69   Configure Apache for your operating system. Normally you can just
70   type run the <CODE>Configure</CODE> script as given below. However
71   if this fails or you have any special requirements (e.g. to include
72   an additional library required by an optional module) you might need
73   to edit one or more of the following options in the
74   <CODE>Configuration</CODE> file:
75     <CODE>EXTRA_CFLAGS, LIBS, LDFLAGS, INCLUDES</CODE>.
76   <P>
77
78   Run the <CODE>Configure</CODE> script:
79   <BLOCKQUOTE>
80    <PRE>
81     % Configure
82     Using 'Configuration' as config file
83      + configured for &lt;whatever&gt; platform
84      + setting C compiler to &lt;whatever&gt; *
85      + setting C compiler optimization-level to &lt;whatever&gt; *
86      + Adding selected modules
87      + doing sanity check on compiler and options
88     Creating Makefile in support
89     Creating Makefile in main
90     Creating Makefile in os/unix
91     Creating Makefile in modules/standard
92    </PRE>
93   </BLOCKQUOTE>
94
95   (*: Depending on Configuration and your system, Configure
96   make not print these lines. That's OK).<P>
97
98   This generates a Makefile for use in stage 3. It also creates a
99   Makefile in the support directory, for compilation of the optional
100   support programs.
101   <P>
102
103   (If you want to maintain multiple configurations, you can give a
104   option to <CODE>Configure</CODE> to tell it to read an alternative
105   Configuration file, such as <CODE>Configure -file
106   Configuration.ai</CODE>).
107   <P>
108
109  <LI>
110   Type <CODE>make</CODE>.
111 </OL>
112
113 The modules we place in the Apache distribution are the ones we have
114 tested and are used regularly by various members of the Apache
115 development group.  Additional modules contributed by members or third
116 parties with specific needs or functions are available at <A
117 HREF="http://www.apache.org/dist/contrib/modules/">&lt;URL:http://www.apache.org/dist/contrib/modules/&gt;</a>.
118 There are instructions on that page for linking these modules into the
119 core Apache code.
120
121 <h2><A NAME="install">Installing Apache</A></h2>
122
123 You will have a binary file called <CODE>httpd</CODE> in the
124 <CODE>src</CODE> directory.  A binary distribution of Apache will
125 supply this file.  <P>
126
127 The next step is to install the program and configure it. Apache is
128 designed to be configured and run from the same set of directories
129 where it is compiled. If you want to run it from somewhere else, make
130 a directory and copy the <CODE>conf</CODE>, <CODE>logs</CODE> and
131 <CODE>icons</CODE> directories into it.  <P>
132
133 The next step is to edit the configuration files for the server. This
134 consists of setting up various <B>directives</B> in up to three
135 central configuration files. By default, these files are located in
136 the <CODE>conf</CODE> directory and are called <CODE>srm.conf</CODE>,
137 <CODE>access.conf</CODE> and <CODE>httpd.conf</CODE>.  To help you get
138 started there are same files in the <CODE>conf</CODE> directory of the
139 distribution, called <CODE>srm.conf-dist</CODE>,
140 <CODE>access.conf-dist</CODE> and <CODE>httpd.conf-dist</CODE>. Copy
141 or rename these files to the names without the <CODE>-dist</CODE>.
142 Then edit each of the files. Read the comments in each file carefully.
143 Failure to setup these files correctly could lead to your server not
144 working or being insecure. You should also have an additional file in
145 the <CODE>conf</CODE> directory called <CODE>mime.types</CODE>. This
146 file usually does not need editing.
147
148 <P>
149
150 First edit <CODE>httpd.conf</CODE>.  This sets up general attributes
151 about the server: the port number, the user it runs as, etc.  Next
152 edit the <CODE>srm.conf</CODE> file; this sets up the root of the
153 document tree, special functions like server-parsed HTML or internal
154 imagemap parsing, etc.  Finally, edit the <CODE>access.conf</CODE>
155 file to at least set the base cases of access.
156
157 <P>
158
159 In addition to these three files, the server behavior can be configured
160 on a directory-by-directory basis by using <CODE>.htaccess</CODE>
161 files in directories accessed by the server.
162
163 <H3>Starting and Stopping the Server</H3>
164
165 To start the server, simply run <CODE>httpd</CODE>. This will look for
166 <CODE>httpd.conf</CODE> in the location compiled into the code (by
167 default <CODE>/usr/local/etc/httpd/conf/httpd.conf</CODE>). If
168 this file is somewhere else, you can give the real
169 location with the -f argument. For example:
170
171 <PRE>
172     /usr/local/etc/apache/src/httpd -f /usr/local/etc/apache/conf/httpd.conf
173 </PRE>
174
175 If all goes well this will return to the command prompt almost
176 immediately.  This indicates that the server is now up and running. If
177 anything goes wrong during the initialization of the server you will
178 see an error message on the screen.
179
180 If the server started ok, you can now use your browser to
181 connect to the server and read the documentation. If you are running
182 the browser on the same machine as the server and using the default
183 port of 80, a suitable URL to enter into your browser is
184
185 <PRE>
186     http://localhost/
187 </PRE>
188
189 <P>
190
191 Note that when the server starts it will create a number of
192 <i>child</i> processes to handle the requests. If you started Apache
193 as the root user, the parent process will continue to run as root
194 while the children will change to the user as given in the httpd.conf
195 file.
196
197 <P>
198
199 If when you run <CODE>httpd</CODE> it complained about being unable to
200 "bind" to an address, then either some other process is already using
201 the port you have configured Apache to use, or you are running httpd
202 as a normal user but trying to use port below 1024 (such as the
203 default port 80).
204
205 <P>
206
207 If the server is not running, read the error message displayed
208 when you run httpd. You should also check the server
209 error_log for additional information (with the default configuration,
210 this will be located in the file <CODE>error_log</CODE> in the
211 <CODE>logs</CODE> directory).
212
213 <P>
214
215 If you want your server to continue running after a system reboot, you
216 should add a call to <CODE>httpd</CODE> to your system startup files
217 (typically <CODE>rc.local</CODE> or a file in an
218 <CODE>rc.<I>N</I></CODE> directory). This will start Apache as root.
219 Before doing this ensure that your server is properly configured
220 for security and access restrictions.
221
222 <P>
223
224 To stop Apache send the parent process a TERM signal. The PID of this
225 process is written to the file <CODE>httpd.pid</CODE> in the
226 <CODE>logs</CODE> directory (unless configured otherwise).  Do not
227 attempt to kill the child processes because they will be renewed by
228 the parent.  A typical command to stop the server is:
229
230 <PRE>
231     kill -TERM `cat /usr/local/etc/apache/logs/httpd.pid`
232 </PRE>
233
234 <P>
235
236 For more information about Apache command line options, configuration
237 and log files, see <A HREF="invoking.html">Starting Apache</A>. For a
238 reference guide to all Apache directives supported by the distributed
239 modules, see the <A HREF="mod/directives.html">Apache directives</A>.
240
241 <H2>Compiling Support Programs</H2>
242
243 In addition to the main <CODE>httpd</CODE> server which is compiled
244 and configured as above, Apache includes a number of support programs.
245 These are not compiled by default. The support programs are in the
246 <CODE>support</CODE> directory of the distribution. To compile
247 the support programs, change into this directory and type
248 <PRE>
249     make
250 </PRE>
251
252 <!--#include virtual="footer.html" -->
253 </BODY>
254 </HTML>