Thursday, January 10, 2008

setup Apache and Tomcat (with mod_jk in Ubuntu), plus load-balancing (or simple clustering)

These directions were kindly shared with me by Matt Dame.

If you're load-balancing between Tomcats, do the following:

  • In the Tomcat 'conf/server.xml' file(s), add the following to the "Engine" element:
    jvmRoute="jvm1"
  • Change the "8009" port on each of the other Tomcats, and change jk.conf accordingly (below).


Start your Tomcat(s). (I've heard of problems if you don't have Tomcat started before starting Apache.)


Run as root:
  • apt-get install apache2 ssl-cert libapache2-mod-jk
  • make-ssl-cert generate-default-snakeoil
  • cd /etc/apache2
  • ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem ssl.crt
  • ln -s /etc/ssl/private/ssl-cert-snakeoil.key ssl.key
  • Place 'http' and 'https' in the 'sites-available' directory. (Note that these are just slightly modified versions of 'default' in that directory).
  • Place 'jk.conf' in the 'mods-available' directory.
  • a2dissite default
  • a2ensite http
  • a2ensite https
  • a2dismod jk
  • a2enmod jk
  • /etc/init.d/apache2 force-reload
---

Andre recommended the following readings about connectors:

generic_howto/loadbalancers.html


reference/workers.html


ajp/ajpv13a.html


reference/apache.html


webserver_howto/apache.html


No comments: