Tomcat

What is Tomcat?

Tomcat is an open source project. The latest version supports JSP 1.1 and Servlet 2.2. In addtion to support dynamic Web pages, it also supports static Web pages.

Download Tomcat at http://jakarta.apache.org/downloads/binindex.html.

Installation and Start/Stop

It is very easy to install Tomcat.

Unzip the downloaded file into some directory.
Set a new environment variable (TOMCAT_HOME).
Win32: "set TOMCAT_HOME=path\tomcat"
UNIX/Linux:
bash/sh "TOMCAT_HOME=path/tomcat ; export TOMCAT_HOME"
tcsh "setenv TOMCAT_HOME path/tomcat"
Set the environment variable JAVA_HOME to point to the root directory of your JDK hierarchy.

Start/Stop Tomcat:

Win 32: path\bin\startup path\bin\shutdown
UNIX/Linux: path/bin/startup.sh path/bin/shutdown.sh

Why do you still need Apache?

Although there is a Web server inside Tomcat, it is recommended to add Apache as a Web server for serving static content. Apache when it comes to static pages. In terms of a Web server, Apache is more powerful and faster than Tomcat. It also support something, such as Perl, PHP, which Tomcat doesn't.

When Tomcat starts up it will automatically generate a configuration file for Apache in TOMCAT_HOME/conf/tomcat-apache.conf. Most of the time you don't need to do anything but include this file (appending "Include TOMCAT_HOME/conf/tomcat-apache.conf") in your httpd.conf. If you have special needs, for example an AJP port other the 8007, you can use this file as a base for your customized configuration and save the results in another file. If you manage the Apache configuration yourself you'll need to update it whenever you add a new context.

Tomcat: you must restart tomcat and apache after adding a new context; Apache doesn't support configuration changes without a restart. Also the file TOMCAT_HOME/conf/tomcat-apache.conf is generated when tomcat starts, so you'll need to start Tomcat before Apache. Tomcat will overwrite TOMCAT_HOME/conf/tomcat-apache.conf each startup so customized configuration should be kept elsewhere.