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