Often you want to use Apache HTTP for static content, yet use Tomcat for JSP and other Java type work. This is a very common infrastructure for enterprise applications, particularly when using ‘pools’ of servers for performance, redundancy and security.
In order to accomplish this, all connections need to be handled by the Apache webserver, which will delegate appropriate requests to Tomcat for it to process.
Here’s a simple setup to get you started:
- First you need to get the connector appropriate to your installation:
- Next make sure the connector file is in the /conf folder of your Apache installation.
NOTE: I prefer to use this path and leave the version name to make maintenance and backups easier.
- Add the following line to httpd.conf
LoadModule jk_module conf/mod_jk-1.2.26-httpd-2.2.4.so
- Now, add the following to http.conf
- Add the c:/APACHEPATH/conf/workers.properties file with the following (minimal) contents:
- Finally, restart both Apache and Tomcat
- The following file should have been created in c:/TOMCATPATH/conf/auto/mod_jk.conf
########## Auto generated on …some datetime… ##########
LoadModule jk_module “C:/APACHEPATH/conf/mod_jk-1.2.26-httpd-2.2.4.so”
JkMount /webdav ajp13
JkMount /webdav/* ajp13
JkMount /servlets-examples ajp13
JkMount /servlets-examples/* ajp13
JkMount /jsp-examples ajp13
JkMount /jsp-examples/* ajp13
JkMount /balancer ajp13
JkMount /balancer/* ajp13
JkMount /host-manager ajp13
JkMount /host-manager/* ajp13
JkMount /tomcat-docs ajp13
JkMount /tomcat-docs/* ajp13
JkMount /manager ajp13
JkMount /manager/* ajp13
If all went well, you should be able to access your Tomcat server webapps on the regular HTTP port used by your Apache installation.