Configuring Apache in front of JBoss Application Server
Configuring Apache in front of JBoss Application Server
Introduction
Apache HTTP server is a highly reliable and proven open source/free web server. It is under
development for over 15 years and is used extensively to host web sites. Since Apache is very
popular and the source code is available, security experts are always looking for any
vulnerability. This makes it one of the most secure web servers.
JBoss AS is a popular open source J2EE application server widely used for deploying web
applications. JBoss is powered by Tomcat servlet container which can also work as a Web server.
However in many production deployments, Apache is configured as the web server in front of the
JBoss server. This is due to the extensive set of features/deployment options offered by Apache
HTTP server.
This article provides a step by step guide on configuring Apache HTTP server as the Web server
in front of the JBoss application server. This guide is written for Microsoft Windows systems
(Windows XP, Windows 7, Windows Server 2008 etc.). However the steps mentioned are similar
on a Linux based system.
Now create a new file named mod_jk.conf inside apache/conf folder. Add the following content
to this file. Please ensure that the name of the module (mod_jk.so) is changed to the actual
module file copied to the modules directory.
The directive JkMount here ensures that all HTTP requests with context /sample/ are forwarded to
the worker1 application server configured in workers.properties (see below).
Open httpd.conf in apache/conf folder and add the following line at the end of the file. This
enables the mod_jk.conf file as an extension to the default configuration file.
Include conf/mod_jk.conf
Create a new file workers.properties inside apache/conf folder. Add the following content to the
file. Note that the name of the JBoss node (worker1) corresponds to the JkMount configuration in
mod_jk.conf file. The host in this case is given as localhost since I have the JBoss running on the
same machine. In actual deployments replace localhost with the ip address/host name of the
JBoss machine.
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
The above configuration indicates that there is a single application server machine available for
handling requests in the localhost and it is available through AJP protocol via port 8009.
Restart apache and JBoss and access your Web application through Apache server using this URL
– http://localhost:80/App1.
1. On the JBoss side, you have to add the AJP connector, which is not inserted by default: