Quickly connect Apache httpd to Railo on Windows

Last night I was getting a development box setup using Windows 7, Apache web server and Railo.  While I generally develop on Linux I am used to this being done automagically for me, however on Windows I did not get a prompt to install the Apache connector.  Looking into the connectors folder I did not see a way to automatically get the connector installed (forgive me if I just overlooked it, Jordan).

I have made the installation on countless Linux installations so I quickly cover getting the connector setup on Windows.  The entire process should only take a few minutes assuming you already have Apache and Railo installed and running on your machine.

Step 1: Get the correct connector for your version of Apache
You can download the connector that matches your servers architecture and Apache version here: http://tomcat.apache.org/connectors-doc/

 Step 2: Copy the connector into your {apache_dir}/modules directory
At the time of this writing, the current version is mod_jk-1.2.21-httpd-2.2.3.so.  When copying the file into your modules directory rename the file mod_jk.so

Step 3: Load the module in Apache
Fire up your favorite editor and add the following line into your httpd.conf file in the modules section:

LoadModule jk_module modules/mod_jk.so

Step 4: Setup JKMount to handle cfc/cfm files
There is one last edit to make in your httpd.conf file.  You should still be in your editor so just scroll all the way to the bottom of the file and paste in this code.  I ripped this code completely from my Linux machines httpd.conf, but on Windows you do have to modify the IfModule block to check for jk_module.  The corrected listing is below:

<IfModule jk_module>
    JkMount /*.cfm ajp13
    JkMount /*.cfc ajp13
    JkMount /*.do ajp13
    JkMount /*.jsp ajp13
    JkMount /*.cfchart ajp13
    JkMount /*.cfres ajp13
    JkMount /*.cfm/* ajp13
    JkMount /*.cfml/* ajp13
    JkMountCopy all
    JkLogFile C:\Apache\logs\mod_jk.log

Restart httpd and Apache should be serving your ColdFusion pages and components.  It took me about 5 minutes to get this up and running, most of that time was spent digging through the Apache website looking for the mod_jk download.  This is my preferred way of configuring Windows systems so I figured I would write this down for my future reference and for anyone else who might find it useful.


15 thoughts on “Quickly connect Apache httpd to Railo on Windows

  1. Hi there. Thanks for this. I have been looking for Amazon SES examples in CF 7 or 8… However, you went the “script route.” Isn’t there another way to send using API calls right out of CF? Advantages I see:

    1) This cuts out the need for an email server at all

    2) This allows you to build an app that might use many different Amazon SES accounts (secret keys).

    Any flaw in this thinking?

    I know the sticking point is going to be the HmacSHA256 signed key. I ran into this when upgrading the Amazon Product API calls a few years ago. CF7 didn’t support this encryption, but CF8 did… Any thoughts on this?


  2. Sorry for taking so long to comment, but I have been out for the last week or so. The component should be easy to to convert to tag-based CFML and I know at least one person who has already done this.

    It should work with little modification pre-CF9, but since Railo 3.x is my production environmnent I don’t really have the time to convert/test it.

    Using multiple keys would be fairly simple to implement by setting your secret keys in the application and moving it out of the awscredentials.properties file. As soon as I have a little time I may take a look at that.

  3. I still can’t get this working on Windows 7.
    I have Railo installed and running separately.
    And then I have Apache2.2 installed and running separately.

    I can’t get the 2 setup to talk to each other or work together.

    I downloaded the mod_jk.so and copied it to the modules folder.
    I also made the necessary changes in httpd.conf.

    However when I restart my apache services it says “Requested operation failed”.

  4. Actually my bad, I got this working.
    Meaning Apache at least restarted successfully.

    Few things.
    I had a misspelling to the path to the mod_jk log file.

    One thing of note, I actually needed to create a mod_jk log file and place it in the location specified. Then Apache would restart correctly.

    However, I cannot serve up CFM pages from my webroot still. Is there some other step in the configuration I am missing?


  5. The problem does lie in my server.xml setup.

    Since this is my local server and I have everything under localhost.
    I don’t need a bunch of virtual hosts setup.

    However it seems like Railo/Tomcat, is looking somewhere other than my Apache webroot to serve up cfm files for localhost.

    So what I want to tell Tomcat is my localhost = C:\{SitesFolder}
    NOT C:\railo…tomcat…apps…something something

    How can I do that? I tried adding a Context path entry in the default setting for the localhost HOST entry, but now instead of an error message I get a white screen of death when trying to run a cfm file.


  6. Robert,

    Yes, after each change I restarted Railo/Tomcat and Apache.

    Currently what I did was add a hosts entry in server.xml, for a host called “devlocal”.
    Then I added an entry in my hosts file for devlocal.

    However nothing in my Apache conf for dev local.

    THe result is now I can browse http://devlocal, and my test html page is served up.
    but still a white screen of death when I try running a cfm page. No longer the Railo error message.

  7. The Apache default DirectoryIndex is index.htm.
    You need to change the httpd.conf file accordingly ==>>

    DirectoryIndex index.cfm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s