Adding Apache HTTP-Server as a front-end

Many linux/unix-servers have Apache HTTP-server installed by default and it may even be used by several previous projects. If so there are many InfoGlue-installations which utilize the web server as a front-end to Apache Tomcat. Even though this is not an InfoGlue-specific task we have decided to include a small and simple how-to here.

First make sure Apache HTTP-server is installed. If you don’t know how you should start on www.apache.org before continuing.

Update: Since a while back we recommend using Mod-proxy (ajp) instead of mod-jk when you want a simple setup. The settings are a bit similar but you should find all information you need on http://tomcat.apache.org/tomcat-6.0-doc/proxy-howto.html.

We will use the Apache mod_jk-module for connecting Apache and Tomcat. Download and install from http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/ or download and compile yourself.

When installed you configure it by adding this or similar last to the httpd.conf (often in /etc/httpd/conf) or in an included file:

#
# Mod_jk settings
#
AllowEncodedSlashes On

JkWorkersFile "/usr/local/tomcat5.5/conf/workers.properties"
JkLogFile "/usr/local/tomcat5.5/logs/mod_jk.log"

JkLogLevel error

JkMount /infoglueCMS default
JkMount /infoglueCMS/* default
JkMount /infoglueDeliverWorking default
JkMount /infoglueDeliverWorking/* default
JkMount /infoglueDeliverPreview default
JkMount /infoglueDeliverPreview/* default
JkMount /infoglueDeliverLive default
JkMount /infoglueDeliverLive/* default

# Use SetEnvIf if you want to let apache take care of all digitalAsset calls so Tomcat only get app-calls. Improves performance quite a bit actually. Use only for the live instances.
SetEnvIf Request_URI "/digitalAssets/*" no-jk

# Now /home will goes to the dir below - Use only for the live instances.
Alias /digitalAssets /usr/local/tomcat5.5/webapps/infoglueDeliverLive/digitalAssets

JkMount /* default
# End of mod_jk settings

Then create workers.properties in the dir pointed out in the conf (in this case /usr/local/tomcat5.5) with the following content:

workers.tomcat_home=/usr/local/tomcat5.5
workers.java_home=/usr/java/jdk1.5.0_04
ps=/
worker.list=default
worker.default.port=8009
worker.default.host=localhost
worker.default.type=ajp13
worker.default.lbfactor=1

Then restart Apache HTTP-server and make sure Tomcat is running. Then call the server through apache. Usually that means calling the same address but on port 80 instead of 8080.