Tomcat 4.1.x and Apache 2.0.x on Linux with mod_jk2.so
$APACHE_HOME refers to the root directory of the Apache 2.0.xx installation (which is /home/apache for this machine). $CATALINA_HOME refers to the root directory of the Tomcat 4.1.xx installation (which is /home/tomcat for this machine). Make the appropriate changes for your installation.
1. Copy mod_jk2.so to $APACHE_HOME/modules
2. Make sure mod_jk2.so is rwx for the owner of the httpd process
3. Create a jk2.properties file with the following information
{{{ #
# Socket configuration
#
handler.list=request,container,channelSocket
#
# socket configuration
#
channelSocket.port=8009
channelSocket.address=127.0.0.1
channelSocket.maxPort=port+10 4. Place this file in $CATALINA_HOME/conf 5. Make sure this file is readable by owner of the tomcat process 6. Create a workers2.properties file with the following information
{{{ #
- # basic workers2.properties file # # # shared memory #
- ["shm"]
- file=/home/apache/logs/shm.file size=1048576 [workerEnv:] info=Global server options timing=1 debug=0 # # IP socket channel # [channel.socket:localhost:8009] port=8009 host=127.0.0.1 # # define the ajp13 worker # [ajp13:localhost:8009] channel=channel.socket:localhost:8009 # # Uri mapping examples - jsp files only # [uri:/examples/*.jsp] worker=ajp13:localhost:8009 # # Uri mapping examples - all servlets # [uri:/examples/servlet/*] worker=ajp13:localhost:8009 }}}
7. Place this file in $APACHE_HOME/conf. 8. Make sure this file is readable by the owner of the httpd process 9. Create the shm.file file using touch 10. Make sure that the shm.file file is rw for both the owner of the httpd process and the owner of the tomcat process 11. Add the following in $APACHE_HOME/conf/httpd.conf to load mod_jk2.so
{{{ #
- # Adding mod_jk2 #
LoadModule jk2_module modules/mod_jk2.so }}}
12. Add the following in $APACHE_HOME/conf/httpd.conf to map the {{{ Tomcat information. This will allow Apache 2.0.x to serve static
- information. Alias /examples/ "/home/tomcat/webapps/examples/"
- }}}
NOTE: Replace /home/tomcat with your location of Tomcat.
13. Shut down the Apache 2.0.x server
14. Shut down the Tomcat 4.1.x server
15. Start the Tomcat 4.1.x server
16. Verify that it is running by browsing http://localhost:8080
17. Start the Apache 2.0.x server
18. Verify the connection by browsing the following:
{{{ http://localhost/examples/jsp
http://localhost/examples/jsp/dates/date.jsp
http://localhost/examples/servlets/
http://localhost/examples/servlet/HelloWorldExample 19. Compare the results to the following:
{{{ http://localhost:8080/examples/jsp
http://localhost:8080/examples/jsp/dates/date.jsp http://localhost:8080/examples/servlets/ http://localhost:8080/examples/servlet/HelloWorldExample }}}
20. If they are the same, you have Tomcat 4.1.x talking to Apache {{{ 2.0.x.
- }}}