mod_jk and jboss
1. Assuming you have Apache2 installed,
If not get the latest Apache2 package from Apache.org and install it. We require no special configuration, just use the default settings.
In the following steps, APACHE_HOME will represent the Apache install directory.
2. Assuming you have downloaded and installed mod_jk 1.2
Download the latest package available from Tomcats’s ‘Download Tomcat connector section’ page . Always download the latest stable release if possible.
Rename the lib mod_jk.so and drop it in APACHE_HOME/modules directory.
NOTE: Don’t use any release prior to mod_jk 1.2.15. Earlier releases are fairly buggy.
3. Setup Apache to use modjk
Add this line at the very bottom in APACHE_HOME/conf/httpd.conf
# Include mod_jk configuration file
Include conf/mod-jk.conf
4. Create the modjk config
Under APACHE_HOME/conf, create mod-jk.conf and populate it as follows:
# Load mod_jk module
# Specify the filename of the mod_jk lib, comment line if you already declared LoadModule jk_module modules/mod_jk.so
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
# Notes:
# 1) Changed from +ForwardURICompat.
# 2) For mod_rewrite compatibility, use +ForwardURIProxy (default since 1.2.24)
# See http://tomcat.apache.org/security-jk.html
JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"
# Mount your applications
JkMount /__application__/* node1
# You can use external file for mount points.
# It will be checked for updates each 60 seconds.
# The format of the file is: /url=worker
# /examples/*=node1
JkMountFile conf/uriworkermap.properties
# 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
# Note: Replaced JkShmFile logs/jk.shm due to SELinux issues. Refer to
# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225452
JkShmFile run/jk.shm
# Add jkstatus for managing runtime data
<Location /jkstatus></Location>
JkMount node1
Order deny,allow
Deny from all
Allow from 192.168.241.116
</Location>
mod_jk is ready to forward requests to JBoss instances. We need now to setup the workers
Note: As of mod_jk 1.2.6+ you need to include “JkMountCopy all” in globals if you intend to specify global JkMount’s or JkMountFile’s instead of per VirtualHost. If you do not want to copy the same JkMount/JkMountFile for each VirtualHost, you can specify “JkMountCopy On” inside the VirtualHost directive.
5. make sure that APACHE_HOME/run and APACHE_HOME/log folders exist
6. Configuring workers
Under APACHE_HOME/conf, create workers.properties and populate it as follows:
# Define list of workers that will be used
# for mapping requests
# The configuration directives are valid
# for the mod_jk version 1.2.18 and later
#
worker.list=node1
# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=8009
worker.node1.host=192.168.241.116
worker.node1.type=ajp13
worker.node1.lbfactor=1
# worker.node1.connection_pool_size=10 (1)
Note: this is a very simple worker file
7. Create the URI to worker map file
Create a uriworkermap.properties file in the APACHE_HOME/conf directory. This file should contain the URL mappings you want Apache to forward to Tomcat. The format of the file is /url=worker_name. To get things started, paste this example into the file you created:
# Simple worker configuration file
#
# Mount the Servlet context to the ajp13 worker
/portal/=node1
/portal/*=node1
/*=node1
Note: I used /* to enable Apache show all contents(css, images, etc)
8. Restart Apache
9. Configure Jboss
Edit jboss-portal-2.6.6.GA/server/default/deploy/jboss-web.deployer/server.xml
locate <Engine> tag element and add an attribute jvmRoute
your tag will now look like <Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">
.
In the server.xml file, make sure that the AJP 1.3 Connector is uncommented
10. Activate the UseJK Valve in JBoss
Edit jboss-portal-2.6.6.GA/server/default/deploy/META-INF/jboss-service.xml
Locate the element with a name of UseJK, and set its value to “true”:
<attribute name="UseJK">true</attribute>
11.Restart JBoss AS
- BROWSE / IN TIMELINE
- « PermGenSpace problem
- » Firebug for your browser.
- BROWSE / IN Uncategorized
- « Hello world! Hello Exist Blog!
- » Firebug for your browser.
SPEAK / ADD YOUR COMMENT
Comments are moderated.
You must be logged in to post a comment.

