|
Firstly, you will need the Tomcat servlet engine for Apache.
This allows the webserver to run server-side java code
("servlets"). There are a number of free and commercial servlet engines out there,
but these instructions will deal with Tomcat specifically.
Tomcat is the reference implementation of the Servlet 2.2
technology.

| |
|
Unarchive it in an appropriate place:

| |
cd /usr/local
tar xzvf jakarta-tomcat-3.2.3.tar.gz
|
The current version of the Tomcat distribution doesn't have the
right permissions set on the files. Fix this by typing:

| |
chmod +x /usr/local/jakarta-tomcat-3.2.3/bin/tomcat.sh
|
For detailed instructions on installing and configuring Tomcat,
see the documentation in the distribution, but essentially, just
do:

| |
cd /usr/local/jakarta-tomcat-3.2.3/bin
./tomcat.sh start
|
Configure Tomcat to use AJP13. This provides speed benefits and
the ability to use HTTPS. Add the following to
TOMCAT/conf/server.xml:

| |
<Connector className="org.apache.tomcat.service.PoolTcpConnector">
<Parameter name="handler" value="org.apache.tomcat.service.connector.Ajp13ConnectionHandler"/>
<Parameter name="port" value="8009"/>
</Connector>
|
Now it's time to configure Apache. The mod_jk howto suggests
using the automatically generated Tomcat config, but sadly this
tries to find loadable modules in /etc/apache/libexec and
it tries to put log files in /usr/local/apache... neither of
which is the Debian way. So, edit your httpd.conf and add:

| |
# Configuration for Tomcat
LoadModule jk_module /usr/lib/apache/1.3/mod_jk-eapi.so
JkWorkersFile /usr/local/jakarta-tomcat-3.2.3/conf/workers.properties
JkLogFile /var/log/apache/mod_jk.log
JkLogLevel warn
JkMount /*.jsp ajp13
|
The last line will ensure that all requests for .jsp files will
be diverted to Tomcat.

| |
|
Finally, it's time to test things. Start Tomcat then Apache:

| |
cd /usr/local/jakarta-tomcat-3.2.3/bin
./tomcat.sh start
apachectl graceful
|
Then, assuming you have the Tomcat default distribution, you
should be able to visit
http://127.0.0.1/examples/jsp/num/numguess.jsp
to see a live example passed from Apache to Tomcat. Note that
you need to start Tomcat and then Apache (always in that order)
and if you restart Tomcat, you will need to restart Apache as
well.

| |