Railo on Apache / Tomcat - windows (part 2)18 Oct 2009 | Comments
The objective of this excercise is to get Apache and Tomcat connected, we want Apache the default web server that serves the port 80 to forward requests to Tomcat - Railo.
The end goal for me in this case, is to get Apache / Tomcat / Railo to serve up http://personal.ecommerce2
Note, this post is really based on very excellent series on installing multiple ColdFusion servers by Dave Shuck: Installing-Railo-under-Tomcat-with-Apache-webserver
Step 1 - Download the Apache - Tomcat connector
Get the connector from http://tomcat.apache.org/connectors-doc/
I'm getting the Windows one since uhm.. I'm setting up my windows environment. Just click on binaries link on that page and find the one for Windows (32 bit in my case) - the latest one available is: mod_jk-1.2.28-httpd-2.2.3.so and so I grabbed that one.
I put the .so file into the :
C:\Program Files\Apache Software Foundation\Apache2.2\modules which my Apache installation folder.
Step 2 - Configure the connector
I then need to tell Apache to load this module when it starts up - so I added this section on my Apache's httpd.conf file - at the bottom of the file:
LoadModule jk_module modules/mod_jk-1.2.28-httpd-2.2.3.so
DirectoryIndex index.html index.htm index.cfm index.cfml
And then I created workers.properties file and put it on
C:\Program Files\Apache Software Foundation\Apache2.2\ folder
The content of that file is like this (straight copy from Dave's post):
# Define 1 real worker using ajp13
# Set properties for worker1 (ajp13)
Step 3 - Adding the site to Hosts, Apache and Tomcat
Next as usual, I added personal.ecommerce2 to my hosts file.
I then added the site definition to my Apache vhost file, which in my case located on:
C:\Program Files\Apache Software Foundation\Apache2.2\conf\extra\httpd-vhosts.conf
This is the section that I added:
JkMount /*.cfm worker1
Next, I need to add the site definition to the Tomcat’s server.xml - which in my case located on C:\opt\railo\tomcat\conf\server.xml
I added this bit at the end of the file (between the closing Host tag and closing Engine tag):
<Host name="personal.cbcommerce2" appBase="C:/prj/personal/cbcommerce" unpackWARs="true"
autoDeploy="true" xmlValidation="true" xmlNamespaceAware="false">
<Context path="" docBase="" reloadable="true" privileged="true" antiResourceLocking="false" anitJARLocking="false" />
Now, I restart Apache and restart Tomcat and go to the URL and it's there!!
This particular site is using ColdBox with URL rewriting on and I couldn't go far navigating the pages because Tomcat doesn't support URL rewriting out of the box.
So for the next challenge for me is to figure out how to get URL rewriting to work on Tomcat - which apparently again not a hard thing to do.. but we'll see..