Thursday, January 24, 2013

How to configure mod_jk to redirect your traffic from Apache Web Server (2.4) to Tomcat?

In corporate environment, there might be a requirement that the system don't allow the end user direct assess to the application server (Tomcat server). They want user assess to web server (Apache Web Server) and the web server redirect the traffic to application server. Hence, the configuration below is to serve the purpose. 

To configure the mod_jk in Apache Web Server (2.4), below are the assumption

1. Use Apache Web Server 2.4
2. Apache home folder is c:\Apache24
3. Place, and in c:\Apache24\conf folder

Step 1 - Open the httpd.conf and add in the configuration as shown below:

# Load mod_jk for communicating with Tomcat
LoadModule jk_module "C:/Apache24/conf/"
# Where to find
JkWorkersFile "C:/Apache24/conf/"
# Where to put jk logs
JkLogFile "C:/Apache24/logs/mod_jk.log"
# Set the jk log level [debug/error/info]
JkLogLevel error
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE, 
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format 
JkRequestLogFormat "%w %V %T"

Step 2 - Add in the to c:\Apache24\conf with the setting as shown below


Step 3 - If you configure virtual host, add the line below to each of the virtual host configuration in httpd-vhosts.conf. Otherwise, add into httpd.conf.

JkMount /myserverpath* worker

1 comment:

MichaƂ Rakoczy said...


First directive should be :