Aim of the Task: Connect Apache Http Server 2.0.63 with Tomcat 5.5
My Apache is running at 80 and Tomcat running at 8080. I have an application running in tomcat at url http://localhost:8080/examples and after this configuration I should be able to access the application through Apache.
1) Download mod_jk
Download the mod_jk module from the following location.
Copy this file to Apache modules directory.
2) Create worker.properties
Create worker.properties in the Apache conf directory and paste the following default content in it.
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
3) Generate mod_jk.conf
This file is auto generated by the Tomcat. Add the following line in the server.xml of Tomcat under the <Server> root tag.
<Listener className="org.apache.jk.config.ApacheConfig" modJk="APACHE_INSTALL_DIR/modules/mod_jk-1.2.27-httpd-2.0.63.so" workersConfig="APACHE_INSTALL_DIR/conf/workers.properties" />
Note: Replace APACHE_INSTALL_DIR with the complete location of the Apache Installation Directory.
Start the tomcat server and if everything is ok then Tomcat will generate the mod_jk.conf under the directory Tomcat5.5/conf/auto.
4) Modify httpd.conf
Now open the httpd.conf file and load this conf.
Include tomcat-5.5/conf/auto/mod_jk.conf
5) Configure Tomcat applications for Apache
Add the following lines to configure how Apache uses JK module.
# Send everything for context /examples to worker named worker1 (ajp13)
JkMount /examples/* worker1
DONE.
Now start Apache and access the examples url without port. Ex: http://localhost/examples