Table of Contents
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 !
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 :
This is on a RH 7.2 machine, BTW.
1) install Tomcat 4. Verify Tomcat 4 (served content on port 8080, examples work).
2) install Apache 2 with DSO support, SSL and apxs. Verify Apache 2 (served content on port 80).
3) download the mod_webapp source, extract it. Read README.txt in the webapp directory after extracting the source.
3) download the Apache Portable Runtime (APR) source from CVS as stated in mod_webapp README.txt, build and install (note: I did not install ant as mentioned in the README.txt file). "./configure --enable-so --enable-ssl --with-apxs"
4) build mod_webapp from source according to README.txt after APR is installed. Make sure the build/configure process is pointed to the right apxs (apache 1.3 or apache 2.0). configure does an "autosense" of which version of Apache you have based on which apxs it can find. "./configure --with-apxs=/your/path/to/apache2/bin/apxs --with-tomcat=/your/path/to/jakarta-tomcat-4.0.3"
5) install mod_webapp according to INSTALL.txt
6) put the following into httpd.conf, verify with "$APACHE_HOME/bin/apachectl configtest": LoadModule webapp_module /usr/lib/apache/mod_webapp.so <IfModule mod_webapp.c> WebAppConnection warpConnection warp XXX.XXX.com:8008 WebAppInfo /webapp-info WebAppDeploy examples warpConnection /examples WebAppDeploy webdav warpConnection /webdav WebAppDeploy tomcat-docs warpConnection /tomcat-docs </IfModule>
7) in $CATALINA_HOME/conf/server.xml, on or about line 291 of 333, change the name parameter of the "Engine" directive to be the same as the ServerName directive in $APACHE_HOME/conf/httpd.conf.
8) Stop apache.
9) Stop tomcat...wait at least 10 seconds. Verify down with "ps -ef |grep java"
10) Start tomcat...wait at least 10 seconds. 11) Start apache.
12) Verify that tomcat examples work on port 80 (http://host.domain.com/examples/) Note that you need the trailing slash! Doing this got me the Tomcat servlets running from host.domain.com/examples (not host.domain.com:8080/examples which is Tomcat stand-alone), so I'm pretty sure everything is set.
The Tomcat I used was the Standard version from: http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.3/bin/ The Apache I used was the standard apache 2.0.36 from one of the mirror sites. The mod_webapp connector I used was retrieved from: http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.3/src/ John Turner
Apache 2 doesn't have two different module directives. Apache 1.x had directives to load the module into runtime (LoadModule) and to enable it (AddModule). So, all modules, both static and dynamc, had to be "Add"-ed, but only dynamical module had to be "Load"-ed first. With Apache 2.0 all statically linked modules are already there and dynamical only have to be loaded.
I got two major problems. 1) with apache 1.3.x is the trailing '/' for a directory. 2) with apache 2.0.36 tells me the index.html not found under the tomcat directory. Both problems are not acceptable for a released product. I cannot ask my users to add a trailing '/' for a directory url because it just is not a normal behavior for apache.
I just did this:
RewriteEngine on RewriteBase / RewriteRule ^webApp$ webApp/ [R]
based on this URL: http://httpd.apache.org/docs/misc/rewriteguide.html in Apache 1.3 with TomCat 4.0.1 using mod_webapp. Seems to work fine...
...