|
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. |