How to integrate Apache 2 with Tomcat 4 on
Windows? |
Abstract: |
This text covers the relocation of
the Tomcat 4 web application directory. Relocation of the web
application is useful if you want to separate your web applications
from the Tomcat installation directory. Updating to a new Tomcat
version can be done with no or very littlemodifications to your web
applications as each application has its specific
server.xml file. The relocation enables you to run
multiple instances of Tomcat.
These instructions have been tested on Windows 2000 with Tomcat
4.1.24. | |
Prerequisites: |
Properly installed J2SE SDK with
JAVA_HOME set in your
environment. | |
Installing Tomcat 4
: |
1. |
Download the Windows binaries:
tomcat-4.1.24.exe |
2. |
Install Tomcat 4 by double-clicking on the
downloaded file and following the prompts. |
2a. |
As Installation Option
choose Normal (Default):
It is not necessary to install Tomcat as NT
Service!
If you want to install Tomcat as NT Service
later you can do this with the tomcat.exe tool.
Using the Windows installer tomcat.exe is only extracted to the
bin directory of the Tomcat installation directory if you have
chosen the NT Service option during
installation. |
2b. |
Follow the next prompts. |
3. |
Set CATALINA_HOME in your environment to
point to the Tomcat 4.1 installation
directory. | |
Relocate the web application
directory: |
1. |
Create a directory to store your
relocated web application directory.
mkdir TomcatApplication |
2. |
Go to the new created directory.
cd TomcatApplication |
3. |
Create the following directories: logs, temp,
webapps, work.
mkdir logs temp webapps work |
4. |
Copy the conf directory from your Tomcat
4.1 installation directory into the relocated directory
TomcatApplication. | |
Configuration: |
|
Relocating the web application
directory means to create an instance of Tomcat. The
server.xml file has to be modified to be specific to this
instance. |
1. |
Change all ports in your conf/server.xml
file in the relocated directory.
Changing all ports allows you to run Tomcat
with the relocated web application directory without any
interference with any other Tomcat instances running on that
system.
[...]
<Server port="11001" shutdown="SHUTDOWN"
debug="0">
[...]
<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8081
--> <Connector
className="org.apache.coyote.tomcat4.CoyoteConnector"
port="11002" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="11003" acceptCount="100"
debug="0" connectionTimeout="20000" useURIValidationHack="false"
disableUploadTimeout="true" /> <!-- Note : To disable
connection timeouts, set connectionTimeout value to -1 -->
[...]
<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="11004" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="11005" acceptCount="10"
debug="0" connectionTimeout="20000" useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
[...]
Please be sure that the port numbers are not already in
use!
|
2. |
Remove the examples context in your
conf/server.xml file in the relocated directory.
[...]
<!-- Tomcat Examples Context -->
<Context path="/examples" docBase="examples" debug="0"
reloadable="true" crossContext="true">
[about 100 lines]
</Context>
[...]
| |
Startup: |
1. |
Set CATALINA_BASE in your environment to
point to the relocated web application directory.
You have already set the needed
CATALINA_HOME in your environment to point to the Tomcat
distribution directory and JAVA_HOME to point to your J2SE
installation directory! |
2. |
Go to the bin directory in the Tomcat 4
distribution directory and start the Tomcat instance.
startup
The started Tomcat instance now uses the
relocated web application directory with the specific
server.xml configuration and listens on port
11002. |
3. |
The instance is ready for deployment
of your web applications in the relocated
directory. | |
Shutdown: |
1. |
Set CATALINA_BASE in your environment to
point to the relocated web application directory.
You have already set the needed
CATALINA_HOME in your environment to point to the Tomcat
distribution directory and JAVA_HOME to point to your J2SE
installation directory! |
2. |
Go to the bin directory in
the Tomcat 4 distribution directory and stop the Tomcat
instance.
shutdown
| |
Administration
applications: |
|
Since Tomcat 4.1 two administration
applications are installed by default:
Tomcat Web Server Administration Tool
Tomcat Manager
These applications have to be configured to be used with the
relocated web application directory of the Tomcat
instance. |
1. |
Copy the files
admin.xml and manager.xml from
the Tomcat distribution directory webapps to the relocated
web application webapps directory.
|
2. |
Edit the files admin.xml and
manager.xml in the relocated web application
webapps directory and adjust the absolute path
docBase to the Tomcat distribution directory.
admin.xml
<Context path="/admin"
docBase="D:/server/ApacheGroup/Tomcat4/webapps/admin" debug="0"
privileged="true">
manager.xml
<Context path="/manager"
docBase="D:/server/ApacheGroup/Tomcat4/webapps/manager" debug="0"
privileged="true">
|
3. |
Access the Administration
Application: http://localhost:11002/admin
Access the Manager Application:
http://localhost:11002/manager/html | |