Automated Tomcat / mod_jk / Apache httpd Setup

Home, Elsternwick, Australia, 2007-11-25 11:43 +1000

#infrastructure #software_engineering

Getting Apache HTTPD and Tomcat to talk to each other via mod_jk is one of those things that always seems to be a painful task. I think this is because of two things. First, there are innumerable ways of configuring Apache HTTPD, and the locations and names of the configuration files may differ depending on your Linux distro, and who built your Apache binaries. Second, while there are many explanations of how to set up HTTPD / mod_jk / Tomcat, most explanations are copy-and-paste configuration dumps with not much explanation of how it all hangs together and what all the configurations mean.

In fact setting up Apache and Tomcat together is very simple once you understand the underlying concepts. Here I’m going to attempt to provide a tutorial on how to setup these two services and also explain what the configurations all mean. I’ll also discuss the way that I’ve arranged my data and configuration files to keep them separated out so that they can be easily backed up and migrated to new hosts as required.

  • Install Debian using preseed.cfg
  • Install Java
  • Install Tomcat
  • Install into Apache
  • Add workers configuration to Apache
  • Link virtual hosts into Apache
  • Link virtual hosts into Tomcat
  • Add JkMount directives to Apache virtual host configurations


Install Java

chmod 700

Install Tomcat and mod_jk

chmod 700

Install JSPWiki

chmod 700

Install Virtual Hosts into Tomcat

<!DOCTYPE Server [
        <!ENTITY virtual_host_com.x1seven.www SYSTEM "/dat/com.x1seven.www/tomcat/conf/virtual_host.xml">