Installation guide
Chapter 3. Configure load balancing using Apache and mod_jk
Follow the tasks in this chapter to correctly configure load balancing using Apache and the mod_jk
connector.
Task: Configure Apache t o Load mod_jk
Complete this task to configure Apache to load mod_jk.
Prerequisit es
Apache and mod_jk installed (Refer to Chapter 2, Download and install).
1. Open HTTPD_DIST/conf/httpd.conf and add the following text at the end of the file.
# Include mod_jk's specific configuration file
Include conf/mod-jk.conf
2. Create a new file named HTTPD_DIST/conf/mod-jk.conf
3. Add the following configuration block to mod-jk.conf.
# Load mod_jk module
# Specify the filename of the mod_jk lib
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/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 indicates to send SSK KEY SIZE
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"
# Mount your applications
JkMount /application/* loadbalancer
# Add shared memory.
# This directive is present with 1.2.10 and
# later versions of mod_jk, and is needed for
# for load balancing to work properly
JkShmFile logs/jk.shm
# Add jkstatus for managing runtime data
<Location /jkstatus/>
JkMount status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
4. Confirm that the LoadModule directive references the right path for the mod_jk library. If not, edit
the path.
5. T he default configuration specifies that static and PHP content is served directly by Apache and
all requests with URL path /application/* are sent to the load balancer. If mod_jk is only to be
used as a load balancer, change the directive to /*.
6. Opt ional: JKMountFile Directive
In addition to the JkMount directive, you can use the JkMountFile directive to specify a mount
point's configuration file. T he configuration file contains multiple T omcat forwarding URL mappings.
a. Navigate to HTTPD_DIST/conf.
b. Create a file named uriworkermap.properties.
c. Specify the URL whose requests are to be forwarded and the name of the worker node to
which they are to be forwarded, using the following syntax example as a guide.
The example block will configure mod_jk to forward requests to /jmx-console and /web-
console to Apache.
The syntax required takes the form /url=worker_name.
JBoss Enterprise Application Platform 5 HTTP Connectors Load Balancing Guide 13