Tomcat+Apache HOWTO by Costin Manolache Anil Vijendran $Revision$ $Date$ This document describes how to setup Tomcat to run with Apache. For now this document describes how to run Tomcat 3.0 with Apache 1.3.9. Check the section on "Tested Configurations" for other Apache/Tomcat versions. ------------------------------------------------------------------------ Table of Contents 1. Introduction 2. Installation 2.1 Apache 1.3.9 2.2 Tomcat 3.0 2.3 Testing Your Configuration 2.4 Adding Contexts 3. Tested Configurations 4. More information, feedback, bugs ------------------------------------------------------------------------ 1. Introduction This document is intended to get you started using Tomcat with Apache until we have Apache and Tomcat as one integrated release. If you ran into any gotchas while following these instructions, please let us know so we can keep this document updated. In the rest of the document, we use /path/to/apache-1.3.9 to mean the path to the Apache 1.3.9 installation and /path/to/tomcat3.0 to mean the path to the Tomcat 3.0 installation. We will assume you are running Apache on the default port (80). 2. Installation 2.1 Apache 1.3.9 * Download and install the Apache 1.3.9 binary for your platform from http://www.apache.org/dist/binaries * Configure the default HTTP listener port in your /path/to/apache-1.3.9/conf/httpd.conf file. * Make sure ServerName in /path/to/apache-1.3.9/conf/httpd.conf contains the name of your host. * If you are using a version of Apache that you have compiled yourself and you are using a precompiled version of mod_jserv.so, make sure that you compiled support for loadable modules. Do this my compiling mod_so.so using --enable-module=so with configure. 2.2 Tomcat 3.0 * Download and install Tomcat 3.0 for your OS/platform from http://jakarta.apache.org/builds/tomcat/release/v3.0// * Download mod_jserv for your platform from http://jakarta.apache.org/builds/tomcat/release/v3.0///modules and copy it into /path/to/apache-1.3.9/libexec for a Unix install and /path/to/apache-1.3.9/libexec for a Win32 install. mod_jserv is the software that allows Apache and Tomcat to communicate. The port used to communicate is set in the server.xml file for Tomcat, and tomcat.conf for Apache, and they must agree. Currently this port defaults to 8007 and uses the AJP12 protocol. * Edit /path/to/apache-1.3.9/conf/httpd.conf and add the following line at the end: Include /path/to/tomcat3.0/etc/tomcat.conf * It is also important to note that because Tomcat has a standalone HTTP server built in, it must be run on a different port than Apache. 2.3 Testing Your Configuration * Restart Apache (apachectl restart or Apache -k restart on Win32) * Make sure http:// is working * Start Tomcat (Use startup.sh for Unix or startup.bat for Win32 from /path/to/tomcat3.0) * Try http:///examples -- you should see the Tomcat examples. 2.3 Adding Contexts There's two different ways you can add contexts to this configuration: (a) * Add to /path/to/tomcat3.0/etc/tomcat.conf: ApJservMount / /root * restart Apache. (b) * Create /path/to/apache-1.3.9/htdocs/ * Install all the files of that context into that directory. * Make sure /path/to/tomcat3.0/server.xml points to /path/to/apache-1.3.9/htdocs/ * Add to /path/to/tomcat3.0/etc/tomcat.conf: ApJservMount //servlet /root AllowOverride None deny from all 3. Tested Configurations Apache 1.3.9 + Tomcat 3.0 has been tested on the following OSes: * Linux (RedHat 6.1) on SPARC and Intel - IBM JDK 1.1.8 * Solaris 2.6 on SPARC - Sun JDK 1.1.8 - Sun JDK 1.2.2 * Windows NT SP 4 - Sun JDK 1.1.8 - Sun JDK 1.2.2 4. More information, feedback and bugs Please send bug reports (both on Tomcat and on this document) to tomcat-dev@jakarta.apache.org. If you tested this on a platform/os that is not listed here, please either update this file (if you have CVS commit access on Jakarta) or send a note to tomcat-dev@jakarta.apache.org.