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.


About Robert Zehnder

Web application developer specializing in ColdFusion/Railo and Open Source development.

Posted on June 3, 2011, in Apache, ColdFusion, Railo, Windows and tagged , , , . Bookmark the permalink. 15 Comments.

  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. Wow this was soo helpful. The other ways I saw around google wasn’t nearly this simple.

  4. 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”.

  5. 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?


  6. Sounds like you are missing something in your Railo configuration. If you are using the installer it should be in {Railo install dir}/tomcat/conf/server.xml. Make sure the directories in your server.xml (docBase) match your web root in Apache.

    I cover it for Linux systems, but it still applies for Windows as well.



  7. 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.


  8. 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.

  9. Did you modify your hosts file in C:\Windows\system32\drivers\etc and add devlocal as a host?

  10. Yes, otherwise I wouldn’t even be able to serve up the html pages.


  11. I think it has something to do with my vhosts file in Apache.

    because when I browse to http://devlocal it does not automatically serve up index.html, I have to specify http://devlocal/index.html

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

    DirectoryIndex index.cfm

  1. Pingback: Adding new sites to Railo demystified « KISDigital Blog

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: