1. Open the file $JONAS_BASE/conf/server.xml and uncomment the
following line:
<!--
<Connector port="9009"
enableLookups="false" redirectPort="9043" debug="0"
protocol="AJP/1.3" />
-->
Edit it to look like the following:
<Connector port="9009"2. Now you can either let tomcat generate the mod_jk.conf file automatically,
enableLookups="false" redirectPort="9043" debug="0"
protocol="AJP/1.3" />
<Listener className="org.apache.jk.config.ApacheConfig"
modJk="$APACHE_HOME/modules/mod_jk.so" />
<Listener className="org.apache.jk.config.ApacheConfig"When jonas/tomcat is restarted, there will be a file created under $JONAS_BASE/conf/auto called mod_jk.conf.
append="true" forwardAll="false"
modJk="$APACHE_HOME/modules/mod_jk.so"/>
b) If you want to create a custom file, the recommendation is to place mod_jk.conf under $JONAS_BASE/conf/jk.
# Load the mod_jk module if not loaded.
<IfModule !mod_jk.c>
LoadModule jk_module "$APACHE_HOME/modules/mod_jk.so"
</IfModule>
# Specify location of worker file and log file. Worker file will follow shortly.
JkWorkersFile "$JONAS_BASE/conf/jk/workers.properties"
JkLogFile "$JONAS_BASE/logs/mod_jk.log"
# When and how much logging.
JkLogLevel emerg
# This is a little awkward. It seems mod_jk associates applications it will
# map to tomcat based on the virtual host. If for instance I wish to visit
# the jonasAdmin application through http://jonas-server/jonasAdmin from another
# machine and I have the following setting then the application behaves
# perfectly normally, i.e, struts kicks in as expected, form based
# authentication and forwarding is done exactly as one would expect if you
# were using the application directly using the appropriate port (9000).
# However, if you try using http://localhost/jonasAdmin from jonas-server
# without the explicit VirtualHost declaration, only the directory contents
# are mapped. So we need to explicitly mention both virtual hosts.
<VirtualHost jonas-server>
ServerName jonas-server
JkMount /olstore ajp13
JkMount /olstore/* ajp13
JkMount /jonasAdmin ajp13
JkMount /jonasAdmin/* ajp13
</VirtualHost>
# ajp13 is infact the worker name used in workers.properties.
<VirtualHost localhost>
ServerName localhost
JkMount /olstore ajp13
JkMount /olstore/* ajp13
JkMount /jonasAdmin ajp13
JkMount /jonasAdmin/* ajp13
</VirtualHost>
3. To tell apache to use this file, edit the
$APACHE_HOME/conf/httpd.conf file and insert:
Include ${JONAS_BASE}/conf/jk/mod_jk.confNote: Replace ${JONAS_BASE} with appropriate value.
4. Create
a workers.properties file. This can be placed in
$JONAS_ROOT/conf/jk/workers.propertiesA sample that has been used successfully is:
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=/usr/lib/jvm/java
#
# You should configure your environment slash... ps=\ on NT and / on UNIX
# and possibly something different elsewhere.
#
ps=/
#
#------ ADVANCED MODE ------------------------------------------------
#---------------------------------------------------------------------
#
#
#------ DEFAULT worket list ------------------------------------------
#---------------------------------------------------------------------
#
#
# The workers that your plugins should create and work with
#
# Add 'inprocess' if you want JNI connector
worker.list=ajp13
# , inprocess
#
#------ DEFAULT worker1 WORKER DEFINITION ------------------------------
#---------------------------------------------------------------------
#
#
# Defining a worker named worker1 and of type worker1
# Note that the name and the type do not have to match.
#
worker.ajp13.port=9009
worker.ajp13.host=jonas-server
worker.ajp13.type=ajp13
#----------------------------------------------------------