summaryrefslogtreecommitdiff
path: root/docs/manual/install.html.en
blob: cc9dcf1af1f4bc974f846c50c4b88412be2d24b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Compiling and Installing Apache</TITLE>
</HEAD>

<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
<BODY
 BGCOLOR="#FFFFFF"
 TEXT="#000000"
 LINK="#0000FF"
 VLINK="#000080"
 ALINK="#FF0000"
>
<!--#include virtual="header.html" -->

<H1 ALIGN="CENTER">Compiling and Installing Apache 1.3</H1>

This document covers compilation and installation of Apache on Unix
systems only. For compiling and installation on Windows, see <A
HREF="windows.html">Using Apache with Microsoft Windows</A> and for
TPF see <A HREF="install-tpf.html">Installing the Apache 1.3 HTTP
Server on TPF</A>.

<P>

UnixWare users will want to consult <A HREF="unixware.html">build notes</A>
for various UnixWare versions before compiling.

<H2>Downloading Apache</H2>

Information on the latest version of Apache can be found on the Apache
web server at <A
HREF="http://www.apache.org/">http://www.apache.org/</A>.  This will
list the current release, any more recent beta-test release, together
with details of mirror web and anonymous ftp sites.

<P>

If you downloaded a binary distribution, skip to <A
HREF="#install">Installing Apache</A>. Otherwise read the next section
for how to compile the server.

<H2>Compiling Apache</H2>

Compiling Apache consists of three steps: Firstly select which Apache
<STRONG>modules</STRONG> you want to include into the server. Secondly create a
configuration for your operating system. Thirdly compile the
executable.
<P>

All configuration of Apache is performed in the <CODE>src</CODE>
directory of the Apache distribution. Change into this directory.

<OL>
 <LI>
  Select modules to compile into Apache in the
  <CODE>Configuration</CODE> file. Uncomment lines corresponding to
  those optional modules you wish to include (among the AddModule lines
  at the bottom of the file), or add new lines corresponding to
  additional modules you have downloaded or written. (See <A
  HREF="misc/API.html">API.html</A> for preliminary docs on how to
  write Apache modules).  Advanced users can comment out some of the
  default modules if they are sure they will not need them (be careful
  though, since many of the default modules are vital for the correct
  operation and security of the server).
  <P>

  You should also read the instructions in the <CODE>Configuration</CODE>
  file to see if you need to set any of the <CODE>Rule</CODE> lines.


 <LI>
  Configure Apache for your operating system. Normally you can just
  type run the <CODE>Configure</CODE> script as given below. However
  if this fails or you have any special requirements (<EM>e.g.</EM>, to include
  an additional library required by an optional module) you might need
  to edit one or more of the following options in the
  <CODE>Configuration</CODE> file:
    <CODE>EXTRA_CFLAGS, LIBS, LDFLAGS, INCLUDES</CODE>.
  <P>

  Run the <CODE>Configure</CODE> script:
  <BLOCKQUOTE>
   <PRE>
    % Configure
    Using 'Configuration' as config file
     + configured for &lt;whatever&gt; platform
     + setting C compiler to &lt;whatever&gt; *
     + setting C compiler optimization-level to &lt;whatever&gt; *
     + Adding selected modules
     + doing sanity check on compiler and options
    Creating Makefile in support
    Creating Makefile in main
    Creating Makefile in os/unix
    Creating Makefile in modules/standard
   </PRE>
  </BLOCKQUOTE>

  (*: Depending on Configuration and your system, Configure
  might not print these lines. That's OK).<P>

  This generates a Makefile for use in stage 3. It also creates a
  Makefile in the support directory, for compilation of the optional
  support programs.
  <P>

  (If you want to maintain multiple configurations, you can give a
  option to <CODE>Configure</CODE> to tell it to read an alternative
  Configuration file, such as <CODE>Configure -file
  Configuration.ai</CODE>).
  <P>

 <LI>
  Type <CODE>make</CODE>.
</OL>

The modules we place in the Apache distribution are the ones we have
tested and are used regularly by various members of the Apache
development group.  Additional modules contributed by members or third
parties with specific needs or functions are available at
&lt;<A HREF="http://www.apache.org/dist/contrib/modules/"
    >http://www.apache.org/dist/contrib/modules/</A>&gt;.
There are instructions on that page for linking these modules into the
core Apache code.

<H2><A NAME="install">Installing Apache</A></H2>

You will have a binary file called <CODE>httpd</CODE> in the
<CODE>src</CODE> directory.  A binary distribution of Apache will
supply this file.  <P>

The next step is to install the program and configure it. Apache is
designed to be configured and run from the same set of directories
where it is compiled. If you want to run it from somewhere else, make
a directory and copy the <CODE>conf</CODE>, <CODE>logs</CODE> and
<CODE>icons</CODE> directories into it.  In either case you should
read the <A HREF="misc/security_tips.html#serverroot">security tips</A>
describing how to set the permissions on the server root directory.<P>

The next step is to edit the configuration files for the server. This
consists of setting up various <STRONG>directives</STRONG> in up to three
central configuration files. By default, these files are located in
the <CODE>conf</CODE> directory and are called <CODE>srm.conf</CODE>,
<CODE>access.conf</CODE> and <CODE>httpd.conf</CODE>.  To help you get
started there are same files in the <CODE>conf</CODE> directory of the
distribution, called <CODE>srm.conf-dist</CODE>,
<CODE>access.conf-dist</CODE> and <CODE>httpd.conf-dist</CODE>. Copy
or rename these files to the names without the <CODE>-dist</CODE>.
Then edit each of the files. Read the comments in each file carefully.
Failure to setup these files correctly could lead to your server not
working or being insecure. You should also have an additional file in
the <CODE>conf</CODE> directory called <CODE>mime.types</CODE>. This
file usually does not need editing.

<P>

First edit <CODE>httpd.conf</CODE>.  This sets up general attributes
about the server: the port number, the user it runs as, <EM>etc.</EM>  Next
edit the <CODE>srm.conf</CODE> file; this sets up the root of the
document tree, special functions like server-parsed HTML or internal
imagemap parsing, <EM>etc.</EM>  Finally, edit the <CODE>access.conf</CODE>
file to at least set the base cases of access.

<P>

In addition to these three files, the server behavior can be configured
on a directory-by-directory basis by using <CODE>.htaccess</CODE>
files in directories accessed by the server.

<H3>Set your system time properly!</H3>

Proper operation of a public web server requires accurate time
keeping, since elements of the HTTP protocol are expressed as the time
of day.  So, it's time to investigate setting up NTP or some other
time synchronization system on your Unix box, or whatever the
equivalent on NT would be.

<H3>Starting and Stopping the Server</H3>

To start the server, simply run <CODE>httpd</CODE>. This will look for
<CODE>httpd.conf</CODE> in the location compiled into the code (by
default <CODE>/usr/local/apache/conf/httpd.conf</CODE>). If
this file is somewhere else, you can give the real
location with the -f argument. For example:

<PRE>
    /usr/local/apache/httpd -f /usr/local/apache/conf/httpd.conf
</PRE>

If all goes well this will return to the command prompt almost
immediately.  This indicates that the server is now up and running. If
anything goes wrong during the initialization of the server you will
see an error message on the screen.

If the server started ok, you can now use your browser to
connect to the server and read the documentation. If you are running
the browser on the same machine as the server and using the default
port of 80, a suitable URL to enter into your browser is

<PRE>
    http://localhost/
</PRE>

<P>

Note that when the server starts it will create a number of
<EM>child</EM> processes to handle the requests. If you started Apache
as the root user, the parent process will continue to run as root
while the children will change to the user as given in the httpd.conf
file.

<P>

If when you run <CODE>httpd</CODE> it complained about being unable to
"bind" to an address, then either some other process is already using
the port you have configured Apache to use, or you are running httpd
as a normal user but trying to use port below 1024 (such as the
default port 80).

<P>

If the server is not running, read the error message displayed
when you run httpd. You should also check the server
error_log for additional information (with the default configuration,
this will be located in the file <CODE>error_log</CODE> in the
<CODE>logs</CODE> directory).

<P>

If you want your server to continue running after a system reboot, you
should add a call to <CODE>httpd</CODE> to your system startup files
(typically <CODE>rc.local</CODE> or a file in an
<CODE>rc.<EM>N</EM></CODE> directory). This will start Apache as root.
Before doing this ensure that your server is properly configured
for security and access restrictions.

<P>

To stop Apache send the parent process a TERM signal. The PID of this
process is written to the file <CODE>httpd.pid</CODE> in the
<CODE>logs</CODE> directory (unless configured otherwise).  Do not
attempt to kill the child processes because they will be renewed by
the parent.  A typical command to stop the server is:

<PRE>
    kill -TERM `cat /usr/local/apache/logs/httpd.pid`
</PRE>

<P>

For more information about Apache command line options, configuration
and log files, see <A HREF="invoking.html">Starting Apache</A>. For a
reference guide to all Apache directives supported by the distributed
modules, see the <A HREF="mod/directives.html">Apache directives</A>.

<H2>Compiling Support Programs</H2>

In addition to the main <CODE>httpd</CODE> server which is compiled
and configured as above, Apache includes a number of support programs.
These are not compiled by default. The support programs are in the
<CODE>support</CODE> directory of the distribution. To compile
the support programs, change into this directory and type
<PRE>
    make
</PRE>

<!--#include virtual="footer.html" -->
</BODY>
</HTML>