Apache in front of JBoss

I finally succeed in putting Apache in front of JBoss. So here is the procedure:
What do I needed?

  • Redhat Enterprise Linux 4 - 64 bits
  • Apache 2.0.52 (included with RHEL4)
  • JBoss 4.0.5 GA (wich includes tomcat 5.5)
  • Mod_JK 1.2.21 (to link Apache and Tomcat)


Step 1: installing JBoss

# cd /opt
# unzip jboss-4.0.5.GA.zip -d .
# cd jboss-4.0.5.GA/server
# cp -a default appl


Step 2: compiling mod_jk
I've tried with precompiled modules, but unsuccessfully. So I've compiled mod_jk by myself.
Need to install httpd-devel and some other stuff located on Linux's disk #4 and #5:

disk 4# cd /mnt/cdrom/RedHat/RPMS
disk 4# rpm -ivh pcre-devel-4.5-3.2.RHEL4.x86_64.rpm
disk 5# rpm -ivh apr-devel-0.9.4-24.5.x86_64.rpm
disk 5# rpm -ivh apr-util-devel-0.9.4-21.x86_64.rpm
disk 5# rpm -ivh httpd-devel-2.0.52-25.ent.x86_64.rpm

Obviously gcc development kit needs to be installed. Now we are in:

# cd /tmp/mod_jk
# cd native
# ./configure --with-apxs=/usr/sbin/apxs
# make
# make install (this will copy the built module to /usr/lib64/httpd/modules)


Step 3: Configure Apache
Nothing here but the default; only make sure httpd.conf includes the extra config files.

# grep "^Include" /etc/httpd/conf/httpd.conf
Include conf.d/*.conf


Step 4: Configure mod_jk

# vi /etc/httpd/conf.d/mod_jk.conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkRequestLogFormat "%w %V %T"
JkMount /* myworker


Step 5: Create a worker

# vi /etc/httpd/conf/workers.properties
worker.list=myworker
worker.myworker.port=8009
worker.myworker.host=myhostname.mydomain.com
worker.myworker.type=ajp13


Step 6: Create a worker map
This maps URI to your worker.

# vi /etc/httpd/conf/uriworkermap.properties
/jmx-console=myworker
/jmx-console/*=myworker
/web-console=myworker
/web-console/*=myworker


Step 7: Check JBoss hot deploy scanner path
In the case you really want to separate users' apps from JBoss, check the deployment scanner scans in your directories, but leave the scanning of deploy (otherwise tomcat won't work).

# vi /opt/jboss-4.0.5.GA/server/appl/deploy/jbossweb-tomcat55.sar/conf/web.xml
...
<mbean code="org.jboss.deployment.scanner.URLDeploymentScanner"
name="jboss.deployment:type=DeploymentScanner,flavor=URL">
...
<attribute name="URLs">
deploy/,/opt/appl/
</attribute>
...
</mbean>
...

Comments

Popular Posts