Simple Apache + Tomcat howto

Only the References chapter is interesting and updated. (Follow the link !!)


Table of Contents

Other formats
1. Introduction
2. Apache
3. TomCat
4. The Warp connector
5. References
6. Notes for the next release

Other formats are avaible : XML Source ; one xhtml file ; multiple xhtml files.

How to setup a Web Server in a Linux or MS-Windows environement with Tomcat, Apache and the WARP Connector (WebApp).

Be careful that the new versions (Apache 2 and tomcat 5) needs some particular changes. I will try to integrate them, but for now, check the References ! Besides, consider using Tomcat stand-alone : if it is fast enough, don't loose your time until the connector configuration is more stable. Enventually consider RESIN ($500) or Orion ($1500 or free non-commercial), whish are much cheaper than the well known BEA WebLogic or IBM WebServer.

The 4.0.4 version of Tomcat is very new. I tested it on Windows but still not on Linux. Besides, which WARP Connector version to use is not clear.

The main problem is to make Apache and TomCat work together. This is done through the WebApp connector, which installation is not trivial.

This can be done with the APJ connector (mod_jk or mod_fk2) too (and Coyote ?). But we will not be treat this here. It is a more "traditional" solution. I didn't find a lot of information which compared the APJ and WARP connectors, but from the little I have read, the WARP one seemed the best. (At least, I saw this note on the Jakarta Web site : [Using the WARP connector is recommended on platforms on which it is available .])

Be careful that the new versions (Apache 2 and tomcat 4) needs some particular changes. I will try to integrate them, but for now, check the Chapter 5 : References at the end of this document !

How to setup Apache 1.3.23 in a Windows 2000 environement.

In a Linux environement the http server is almost always already installed.

There is a new version : Apache 2.0.36 wich is much better; I will update soon.

Installation. Go to the Apache "HTTP Server" project page. Download the file apache_1.3.23-win32-x86-no_src.msi. Or use one of the other distribution file from this directory. As usual, execute the file and don't panic when it ask questions, you will modify this later in the httpd.conf file. Configuration : the only file I modified is the %Apache_home%/conf/httpd.conf.

			...
			ServerName 152.118.12.179
			...
			

I put my IP adress 152.118.12.179 but generaly Localhost should be OK.

How-to put the data on an different partition. It is useful if you want some precious data to be on a secific directory. This directory can be backed-up or more secure.This is done with the httpd.conf file.You can put the whole ServerRoot and conf files to an other directory. You can move just site data (the DocumentRoot.) You can put each new VirtualHost on differents directory (with or without their log file ...)The easier is to create a new virtual host, since it won't screw up others configurations.If you change the DocumentRoot, don't forget to change the following <directory ...> too.

			...
			DocumentRoot "D:/bruno/doc/Dev/Web"
			...
			<Directory "D:/bruno/doc/Dev/Web">
			...
			

Be careful that the new versions (Apache 2 and tomcat 4) needs some particular changes. I will try to integrate them, but for now, check the Chapter 5 at the end of this document !

How to setup Tomcat 4

Installation (Windows 2000). Go to the Tomcat page of the Apache "Jakarta" project. Download the file jakarta-tomcat-4.0.3-LE-jdk14.tar.gz (2.6Mo) If you have the J2SE 1.4. Or use one of the other distribution file from this directory. You can unpack the files in your "C:\Programs" directory. You can launch and stop Tomcat with the Startup.bat and Shutdown.bat files in the bin directory. Note : with the 4.0.3 version the examples didn't work "out of the box". I have to comment out two filters : "Set Character Encoding" and "Compression Filter" from the "examples/WEB-INF/web.xml" file. Errors were reported in the log file : logs/localhost_examples_log ...

Installation (Linux). Go to the Tomcat page of the Apache "Jakarta" project. (At the time of writing this the RPM directory is not clean ! I better advise to wait or not to use the RPM version !) Download the files tomcat4-4.0.1-1.noarch.rpm (2.2Mo) and tomcat4-webapps-4.0.1-1.noarch.rpm (1.3Mo). Or use one of the other distribution file from this directory. Simply use a package manager to install them. Tomcat is configured as a service (daemon). You have to modify /etc/tomcat4/conf/tomcat4.conf to point to your JVM (by default it use "/opt/IBMJava ... ")

How-to put the data on an different partition. Edit your server.xml file (in the "C:\Programs\jakarta-tomcat-4.0.3-LE-jdk14\conf" directory.) In the <Service name="Tomcat-Apache"> change the following :

			...
		    <Engine className="org.apache.catalina.connector.warp.WarpEngine"
				name="Apache" debug="0" defaultHost="152.118.12.179" 
				appBase="D:/bruno/doc/Dev/web/webapps">

				<Host name="152.118.12.179" debug="0" 
					appBase="D:/bruno/doc/Dev/web/webapps" unpackWARs="true">

					<!-- Tomcat Examples Context -->
					<Context path="/examples" 
						docBase="D:/bruno/doc/Dev/web/webapps/examples" debug="0"
						reloadable="true"/>
				</Host>

				<!-- Global logger unless overridden at lower levels -->
				<Logger className="org.apache.catalina.logger.FileLogger"
					prefix="apache_log." suffix=".txt"
					timestamp="true"/>

				<!-- Because this Realm is here, an instance will be shared globally -->
				<Realm className="org.apache.catalina.realm.MemoryRealm" />

			</Engine>
			...
		

This cover only the <Service name="Tomcat-Apache">. Not the Stand-alone service.

Be careful that the new versions (Apache 2 and tomcat 4) needs some particular changes. I will try to integrate them, but for now, check the Chapter 5 at the end of this document !

How to setup Warp connector (mod_webapp) (Windows 2000).

I will write explanation for the a Linux environement.

Installation (Windows 2000). Go to the Tomcat page of the Apache "Jakarta" project. Download the file webapp-module-1.0-tc40-windows.zip (64Ko). Or use one of the other distribution file from this directory. (Note that even the current Tomcat version is 4.0.3, the connectors are still in their own version directory.) Unpack libapr.dll and mod_webapp.so in your "C:\Program Files\Apache Group\Apache\modules" directory. You do NOT need to put the .dll in your winNT/System directory as it is requested in the INSTALL.txt !

Installation (Linux). Go to the Tomcat page of the Apache "Jakarta" project. Download the file webapp-module-1.0-tc40-linux-glibc2.2.tar.gz. Or use one of the other distribution file from this directory. (Note that there is a mod_webapp.so (400Ko) in the v4.0.2 directory.) Note that Tomcat is version 4.0.3 but WARP is in the 4.0.1 directory ...Copy mod_webapp.so in your "/Apache/libexec" directory.

Configure Apache. I followed the INSTALL.txt for this. Edit your httpd.conf file (in the "C:\Program Files\Apache Group\Apache\conf" directory.) Add the line "LoadModule webapp_module modules/mod_webapp.so" after all the other "LoadModule ... " lines. Add the line "AddModule mod_webapp.c" after all the other "AddModule ... " lines. At the end of the file : add the lines

			WebAppConnection warpConnection      warp  152.118.12.179:8008
			WebAppDeploy     examples  warpConnection  /examples
		

And you can add this line "WebAppInfo /webapp-info", if you want to connect to "http://localhost/webapp-info/" to know how is your WARP connector. I put my IP adress (152.118.12.179) but localhost should be OK.

Configure Tomcat.  Edit your server.xml file (in the "C:\Programs\jakarta-tomcat-4.0.3-LE-jdk14\conf" directory.) Remove all the standalone service : from <Service name="Tomcat-Standalone"> to </Service>. So it leaves only the service <Service name="Tomcat-Apache">. This way, you are shure that Tomcat is only accessed through the Apache http Server.

Others How-To , guides and tutorials about installing Apache and Tomcat with a Coyote JK (mod_jk) or Warp connector (mod_webapp) or with AJP. In no particular order !

References chapter

I will try to maintain this list up to date, to provide more comparativ informations about them, to improve my own How-To, to use some RDF stuff (like dmoz, Dublin Core metadata editor) and to translate it in french. (That's a lot, be patient.)

Note that there are about 80 hits per days on this page : there is a huge demand on documentation !!! Enventually consider RESIN ($500) or Orion ($1500 or free non-commercial), whish are much cheaper than the well known BEA WebLogic or IBM WebServer.

I am just taking a few notes (mainly from the mailing list) for my next HowTo.

Notes from the mailing list for the future release :