Monday,
December 3, 2001
Reliable & free! It has to be Apache! by Nakul Goyal
WEB servers come in various shapes and sizes. They run under
a variety of operating systems, have varying levels of power
and complexity, and range in price from rather expensive to
free. One of them is Apache.
Apache is special
Apache is maintained by the Apache Software Foundation’s
Apache Server Project at www.apache.org. The Apache Web
server, for those of you who haven’t heard of it, is
arguably the most popular Web server in use on the Internet
today. While Microsoft contends that its Internet
Information Server (IIS) is making huge gains, it’s still
struggling in many ways against Apache. The reasons are not
hard to seek. For starters, you don’t have to be running
Windows to run Apache. It was first developed on the various
Unix/Linux/BSD platforms, then recently ported to Win32. The
IIS, while a good Web server on the NT platform, is trapped
in the "Windows-only" world. While IIS has many handy
features, not everyone wants to run NT for their Web
server’s OS.
Getting Apache
Another reason for Apache’s widespread acceptance is its
overall stability. The Apache Web server service is near
bombproof. Lastly, it is relatively fast. Relative to what
you’re doing with it. If you’re hosting a Website with
mostly static content, Apache is a fireball. If you throw
tons of CGI scripts at it, while making database calls at
the same time, you’re going to slow it down. Much of the
slowdown will come from your scripts themselves and not
Apache.
Apache is available from www.apache.org. While you’re
downloading the Apache package that’s appropriate for your
Operating System, be sure to grab the documentation.
If you’re a Linux user, the odds are in your favour that
Apache has been pre-installed. With the exception of
desktop-centric Linux such as Caldera, it’s rare that you
won’t have the Apache server installed. During your Linux
installation, if you see an option for "Web services" make
sure to select it so that Apache will be installed.
If you’re new to the Unix/Linux/BSD world, you should be
aware that there are two types of installation packages —
source and binary. If you’re new to the Unix world, try to
download a binary format. A binary is the fully compiled
version of the application that’s ready to be installed on
your system.
A source package is just that, it’s the source code to the
application. This means you have to compile it into an
executable program all by yourself. One often messes up
while compiling an application. If you are fortunate, you’ll
find your error immediately. If you’re unlucky, it could be
hours, days or weeks before you find out, and then you have
to spend time recompiling again to fix your mistakes. Do
yourself a favour when first learning Apache — find the
binary package for your OS. You can learn the finer points
of compilation later.
Installing & running Apache
Those of you running the RedHat Linux distribution may want
to take advantage of RedHat’s RPM ("RedHat Package Manager")
system. Almost identical to a binary, an RPM is further
customised to play nicely with other RPMs and provide a
consistent interface to installing, updating, and removing
binaries. They often entail a loss of flexibility and
clarity—for instance, it’s not readily apparent where the
contents of some packages will end up. That said, for Linux
newcomers or when installing a small standard component,
RPMs are simple and reliable.
Bear in mind that an Apache RPM may already be installed on
your system depending on how Linux was originally installed.
To find out, at the shell prompt, type:
rpm -qa | grep apache
If you see apache-1.3.9xxx, an Apache RPM has already been
installed and you can skip on to "Starting Apache."
If you don’t have an Apache RPM, you must obtain one. RedHat
6.x Onwards ships with Apache-1.x.x-x.i386.rpm in the RedHat/RPMS
directory on the installation CD. Or, point your Web browser
at ftp://ftp.redhat.com/pub/redhat/current/i386/RedHat/RPMS
and pick yourself up a copy.
To install Apache from scratch, read on. Or you can skip on
to Starting Apache. Just three more commands than a binary
installation and you skip the arduous task of figuring out
which binary is the right one for your particular operating
system.
Point your Web browser at www.apache.org/dist and download
the gzip’d form of the current version of Apache.
Now let’s uncompress that archive using gunzip and tar. You
should replace the apache_1.3.11.tar.gz below with the name
of the gzip’d file you download.
gunzip < apache_1.3.11.tar.gz | tar xvf -
You should end up with an apache_1.3.x directory, x being
the particular sub-version of Apache you downloaded. Move
into the newly-created directory.
cd apache_1.3.x
Now we’ll use configure and make commands to configure,
make, and install Apache. If you’ve not already done so, now
would be the time to become root.
./configure
Your screen should look something like:
# ./configure
Configuring for Apache, Version 1.3.11...
Creating Makefile
Creating Configuration.apaci in src
Creating Makefile in src
+ configured for Linux platform
+ setting C compiler to gcc
+ setting C pre-processor to gcc -E
+ checking for system header files
+ adding selected modules
+ checking sizeof various data types
+ doing sanity check on compiler and options ...
Creating Makefile in src/modules/standard
Unless errors are reported (not warnings, mind you), your
Apache installation is now configured and we can move on.
This is where it gets a bit complex. Make Apache produces
screenfulls of scary-looking output, but don’t worry — as
long as the process doesn’t stop suddenly with an errror
message, all is as it should be.
Your screen should look something like:
# make
===> src
make[1]: Entering directory `src/httpd/apache_1.3.11’
make[2]: Entering directory `src/httpd/apache_1.3.11/src’
===> src/regex ...
[several lines later] ...
gcc -DLINUX=2 -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite
-DNO_DL_NEEDED `../apaci` -o ab -L../os/unix
-L../ap ab.o -lap -los -lm -lcrypt
make[2]: Leaving directory `src/httpd/apache_1.3.11/src/support’
<=== src/support
make[1]: Leaving directory `src/httpd/apache_1.3.11’
<=== src
#
Finally, you’re ready to install your Apache build.
# make install
And you’re done!
Performance Settings
There are multiple performance settings you can activate in
Apache. Each of these is designed to prevent slow user
connections from hogging up all servers’ resources. They can
also be used to prevent things like Web spiders from hogging
up the resources.
Starting Apache
Let’s take your new Apache installation out for a spin.
* If you installed Apache using a binary or from scratch, as
root, type /usr/local/apache/bin/apachectl start
* If you used an RPM, as root, type httpd
Point your browser at your brand new Web server, http://localhost
or http://127.0.0.1 (Internal Loopback IP Address),
substituting your server’s hostname for localhost and you
should see the default home page.
This can be read online at Tribune's Website at the
following URL:
http://www.tribuneindia.com/2001/20011203/login/software.htm