May 22, 2000
Brought to you by:
Table of contents
Got a tough Linux deployment question? Ask the experts!For a limited time, you can put the authors of "Deploying Web and FTP Servers" to the test. Post your question, and if they answer it, you'll receive a free Network Computing collectable. Click here for more info.
|
Installing Apache
Web Server
Traditionally, Apache
required recompiling every time you wanted to add a new feature, or ýmodule',
as all modules were compiled into the Apache executable. More recently, the
Apache group have incorporated support for DSO linking, which, like DLLs in
Windows, allow new modules to be added later without recompiling the whole
program. We will install Apache using DSO linking, which will make installation
of ApacheJServ and other modules easier. Static linking is very slightly faster
in operation than DSO linking, and some older distributions of Linux will not
allow DSO. If you have to do a static installation, just leave out the --enable-module=most and --enable-shared=max parameters in step 4.
1. If you are using Red Hat 6.0, you first need to correct an error in
the distribution, by making a C header file available from its correct
location. Type:
# ln -s /usr/include/db1/ndbm.h
/usr/include/ndbm.h
2.
Download the latest version of
Apache (www.apache.org) to /usr/local/src,
unzip and extract it:
# tar -xvfz apache_x_x_x.tar.gz
3.
Enter the created directory:
# cd /usr/local/src/apache_x_x_x
The next three steps configure, build and install Apache.
The first parameters supplied to the configure script specifies the path for
the apache installation.
4.
# ./configure --prefix=/usr/local/apache
--enable-module=most --enable-shared=max
5.
# make
6.
# make install
That's it ‑ Apache is installed!
We will cover the configuration fully later in the chapter, so for now we will
just configure enough to test it:
1.
Open /usr/local/apache/conf/httpd.conf for editing.
This contains every configuration command
for the entire server, so it may look quite intimidating. However, don't be put
off as it is simpler than it looks!
2.
Search for the ServerName directive
(about a third of the way through). Replace it with ServerName http://localhost -- we will use a
real network identity later, but using localhost for
now provides us a simple check of our Apache installation. Save and
close httpd.conf.
3.
Start the apache server with the command /usr/local/apache/bin/apachectl start.
4.
If Netscape, or some other web browser, is
installed, type http://localhost
into the location bar. If not, type lynx localhost
at
the command line. Either way, you should be presented with a congratulations
page:

Getting to Know the
Web Server
Your
working web server installation should be self-contained within /usr/local/apache. If you installed Apache
differently (e.g. using a Red Hat RPM), and find your configuration changes
aren't having any effect, try searching for stray files: type find / -name httpd.conf -- print. Some proprietary
distributions place the active httpd.conf in other folders.
Inside
/usr/local/apache will be a set of further
directories, the ones we will use are:
bin ‑ contains all the program executables
cgi-bin ‑ which is the default location for CGI files
conf ‑ contains all the Apache configuration files
htdocs ‑
the default root directory for your web site. A sample index.html file is
already in this directory to produce the 'It Worked' page you saw in the last
section
logs ‑ contains all the server logs by default. We will deal with
these in more depth later.
We
will change the locations of the default web site root directory and CGI
location later when we cover Apache configuration, and develop a consistent
placement of all web site content within the /home directory where it is well
separated from the application. Separating content from application is a useful
technique if your fellow system administrators make the occasional mistake when
updating web site content.
To start Apache, type:
/usr/local/apache/bin/apachectl start.
To stop Apache, type:
/usr/local/apache/bin/apachectl stop.
The
above two commands can be performed together. To restart Apache, type: /usr/local/apache/bin/apachectl
restart. The alternative command /usr/local/apache/bin/apachectl graceful
does
the same but finishes serving any current
requests
first.
©1998 Wrox Press Limited, US and UK..