1. The system used in this tutorial has the following installed : Tomcat 6.0.14, Apache 2.2.8
  2. See on <tomcat_home>/conf/server.xml
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
  3. Download mod_jk from here
  4. Install mod_jk in Apache module directory
    • On Linux, usual location : 
      • /usr/lib/apache/
      • /usr/lib/apache2/
      • /usr/local/apache/libexec/
    • On Windows, usual location :
      • C:\Program Files\Apache Group\Apache\modules\
      • C:\Program Files\Apache Group\Apache2\modules\
  5. Here is the minimum which should be set in httpd.conf directly or included from another file:
    # Load mod_jk module
    # Update this path to match your modules location
    LoadModule jk_module libexec/mod_jk.so
    # Declare the module for
    # AddModule mod_jk.c
    # Where to find workers.properties
    # Update this path to match your conf directory location (put workers.properties next to httpd.conf)
    JkWorkersFile /etc/httpd/conf/workers.properties
    # Where to put jk logs
    # Update this path to match your logs directory location (put mod_jk.log next to access_log)
    JkLogFile /var/log/httpd/mod_jk.log
    # Set the jk log level [debug/error/info]
    JkLogLevel info
    # Select the log format
    JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
    # JkOptions indicate to send SSL KEY SIZE,
    JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
    # JkRequestLogFormat set the request format
    JkRequestLogFormat "%w %V %T"
    # Send everything for context /examples to worker named worker1 (ajp13)
    JkMount /examples/* worker1
    

    A complete documentation of Apache configuration is available in Apache HowTo.

  6. Here is a minimum workers.properties , using just ajp13 to connect your Apache webserver to the Tomcat engine, complete documentation is available in Workers HowTo.
    # 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
    worker.worker1.lbfactor=50
    worker.worker1.cachesize=10
    worker.worker1.cache_timeout=600
    worker.worker1.socket_keepalive=1
    worker.worker1.socket_timeout=300
    

    You can compare the properties for worker1 with Connector port on <tomcat_home>/conf/server.xml

[Source]

Advertisements