12.31.2010

Apache mod_jk configuration for Jboss application server

This article describes the steps to configure apache mod_jk module with JBoss application server.
Apache mod_jk is a "bridge" between the Apache web server and the Jboss application Server. "Normal" web requests over port 80 are handled by Apache and then java servlet and JSP are forwarded to the Application server(Example Jboss).


 Apache Configuration:

 1. Download Apache Tomcat connectors (mod_jk) binaries from below URL

http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.27/x86_64/mod_jk-1.2.27-httpd-2.2.6.so

 2. Copy 'mod_jk-<Version>.so' to '$APACHE_HOME/modules'

 3. Create a new folders 'run' and 'mod_jk' in  $APACHE_HOME location.

 4. Edit the '$APACHE_HOME/conf/httpd.conf' file with following entries to load 'mod_jk' and 'server name'.
                        Include mod_jk/mod_jk.conf
                        ServerName <Server name>:<Port number>

 5. Extract the attached mod_jk_conf.zip in '$APACHE_HOME/conf' location.
 6. Move mod_jk.conf from '$APACHE_HOME/conf' to '$APACHE_HOME/mod_jk'

 7. Edit workers.properties present in '$APACHE_HOME/conf' with the JBoss servername and corrosponding AJP port number.

 JBoss Configuration:

 In this section we configure the JBoss instances on all clustered nodes so that they can expect requests forwarded from the mod_jk load balancer

1. Edit the server.xml file present in  <JBOSS_HOME>/server/<site-Name>/deploy/jboss-web.deployer/ with the following entries

   <Connector port="8080" address="${jboss.bind.address}"
         maxThreads="250" maxHttpHeaderSize="8192"
         emptySessionPath="true" protocol="HTTP/1.1"
         enableLookups="false" redirectPort="8443" acceptCount="100"
         connectionTimeout="10000" disableUploadTimeout="true" URIEncoding="UTF-8"    />
<!-- These entries will be already present in the server.xml file, Just enter the worker name in jvmRoute value -->
      <Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">


 2. Edit the jboss-service.xml under <JBOSS_HOME>/server/<site-name>/deploy/jboss-web.deployer/META-INF  with the following entry to enable JK module

       <attribute name="UseJK">true</attribute>

3. Restart the apache web server and JBoss application server.       

No comments:

Post a Comment