Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search
Next Previous Contents

3. How to Setup the Web Server

There are several Web Servers available for Linux. These include:

If you are going to try just one Web Server, I suggest you initially try Apache, principally because it comes with most major Linux distributions and may already be installed, and perhaps running, on your system.

3.1 Apache

Background

Apache is the most popular HTTP server on the Internet. It was originally based upon the NCSA httpd and has since been completely rewritten. It is Open Source licensed. (From the Apache website.)

Download, Installation, and Setting up Your Environment

Rather than downloading from Apache, I suggest you initially try the Apache that most likely came with your Linux distribution.

Alternatively, Apache can be obtained from http://www.apache.org.

Confirming Your Installation

To confirm that Apache is installed and running on your computer, open your web browser, and enter the URL: "http://127.0.0.1". (127.0.0.1 is the IP address for the localhost.)

You should see a web page to the effect of "It Worked!"

If it did not work, you can confirm that Apache is installed by typing the following on a RedHat Package Manager (RPM)-based Linux distribution.

rpm -q | grep apache

To start Apache, type:

cd /etc/rc.d/init.d
./httpd start

Note: The httpd script used at boot time may be in a different location on other Linux distributions.

For more assistance, I suggest you look into the Apache FAQ at http://www.apache.org/docs/misc/FAQ.html.

3.2 IBM Domino

To be written.

See http://www.lotus.com/dominolinuxfor more information.

3.3 IBM HTTP Server

Background

The IBM HTTP Server is an IBM repackaging of Apache. You might consider using the IBM HTTP Server if you plan on working with IBM WebSphere.

At the time of this writing, the most recent version is 1.3.6.1.

Download

The IBM HTTP Server can be obtained from http://www-4.ibm.com/software/webservers/httpservers/download.html.

Click on the download link and select 56-bit or 128-bit SSL encryption.

You will need to register with IBM, fill out a marketing survey, and accept the license agreement before downloading. The IBM HTTP Server requires glibc either version 2.0 or 2.1. glibc is the new Linux libc. If you have an older distribution that is based upon libc5, you will not be able to use the IBM HTTP Server.

On an RedHat Package Manager (RPM)-based Linux distribution, you can run:

rpm -qa | grep libc

You will see output such as:

glibc-2.1.2-11
libc-5.3.12-31

This will show you which versions of libc5 and glibc you have installed on your Linux distribution. In my above example I have both glibc and libc5 installed on my system. glibc is version 2.1, so I would want to download the files for glibc2.1.

I suggest downloading all of the tar files for the glib version of Linux that you have as they are relatively small. However, minimally you will need the server file. For RedHat 6.0 and distributions derived from Redhat 6.0 you will also need the redhat60only. For glibc2.0 based distributions you will also need the libstdc file.

Installation

I suggest installing files in the /usr/local directory. After downloading the files, run:

mkdir /usr/local/ibm
mv HTTPServer.linux.* /usr/local/ibm

You can now open the distribution package file or files.

tar xvf [filename].tar

Where [filename] is the name of the file.

Under the /usr/local/ibm directory, you now should see the directory IHS.

Use the RedHat Package Manager (RPM) to install the rpm files that the tar file produced. If you needed the libstdc file, you will need to install that file first. Then you would install the server RPM file such as:

cd IHS
rpm -i IBM_HTTP_Server-1.3.6-2.i386.rpm

The above example shows version 1.3.6 for the Intel architecture. Substitute the filename as appropriate.

After installing you can delete the rpm files as they can be easily recreated from the tar files.

Setting up Your Environment

The environment variables to set up are:

The IBM HTTP Server installed itself into /opt/IBMHTTPServer. You need to add its bin directory to your PATH.

export PATH=/opt/IBMHTTPServer/bin:$PATH

Note that /opt/IBMHTTPServer/bin was added to the front of the PATH so that the installed Web Server will be used rather than any Web Server that might have come with your Linux distribution.

To confirm that your PATH is correctly set up, check which Apache controller will be used. Type:

which apachectl

The output should reference apachectl in the /opt/IBMHTTPServer/bin directory.

Note: because the IBM HTTP Server is based upon Apache, it uses the Apache controller to start and stop it. When you have both the IBM HTTP Server and Apache installed on a computer, take particular care to your PATH to make sure you are working with the correct server.

You may need to modify the IBM HTTP Server configuration file. The configuration file was installed in /opt/IBMHTTPServer/conf/httpd.conf. The most common two entries that need to be changed are the ServerName and the Listen port number. Look for the key words "ServerName" and "Listen" in the httpd.conf file. The ServerName should be set to either your hostname or IP address. If your computer uses DHCP to acquire an IP address, the hostname is a better candidate. However, in order to use your computer's hostname, your computer's hostname and IP address must be properly registered in DNS.

Additionally if you are running another Web server on the computer you need to assign the IBM HTTP Server to another port so you can run both Web servers simultaneously if necessary.

The following is an example entry in httpd.conf.

ServerName 192.168.0.4
Listen 3000

Confirming Your Installation

To start the IBM HTTP Server, type the following:

/opt/IBMHTTPServer/bin/apachectl start

To confirm that the IBM HTTP Server is installed and running on your computer, open your web browser, and enter the URL: "http://192.168.0.4:3000" substituting the correct IP address and port number entered into httpd.conf.

You should see a web page to the effect of "Welcome to the IBM HTTP Server". Contratulations, you have installed, set up an environment for, and tested the IBM HTTP Server for Linux.

More Information

For more information, I suggest you look into the IBM HTTP Server Support page at http://www-4.ibm.com/software/webservers/httpservers/support.html.

3.4 Jetty HTTP Server and Servlet Container

Background

Jetty is an Open Source HTTP Servlet Server written in 100% Java. It is both a full featured HTTP/1.1 server and a Servlet Container. It is designed to be light weight, high performance, embeddable, extensible and flexible, thus making it an ideal platform for serving dynamic HTTP requests from any Java application.

Jetty can be used as a stand-alone HTTP server and servlet container or it can be embedded in another java application (eg. the JBoss EJB container is using Jetty as it's prefered server and container solution).

As a combined server and servlet container, both these functions run efficiently in a single unix process. Installation and configuration is also simpler as a single application.

Download

The Jetty HTTP Server and Servlet container may be downloaded via:

http://jetty.mortbay.org.

Jetty is distributed under the artistic license, full source is included and it can be used and distributed commercially.

Installation

The package is distributed as a gzipped tar file, which can be unpacked with:

gunzip < Jetty-x.x.x.tgz | tar xf - 

Which will create a Jetty-x.x.x directory where x.x.x is the version number.

To run the demo server:

export JETTY_HOME=<jetty install directory>
export JAVA_HOME=<JRE install directory>
$JETTY_HOME/bin/jetty.sh run 
Then to see the Jetty demo and tutorial point a browser at http://localhost:8080.

Jetty can also be installed and run via JMX or as part of the JBoss distributions. See http://jetty.mortbay.org or the README.TXT file for more details.


Next Previous Contents