Apache Railo Tomcat Windows installation

February 10, 2012 by Jean

Some notes on our standard Windows + Apache + Railo + Tomcat + Apache (=WART?) install.

Railo can be installed 2 different ways:

  • Common class install: makes Railo global to the Tomcat server. All hosts share the same Railo server context, and have a unique dedicated Railo web context. That's the setup you end up with when using the Railo installers.
  • WAR install: requires a new war deployment for each host, and each host ends up with its own Railo server and web context.

We are going for the war install, to keep the option to run other Tomcat webapps (like solr) on the same server.

Install Tomcat

Install a JRE and Tomcat (avoid spaces and dots in the install path), check that all is good at http://localhost:8080.

Install Railo

  • Download the Railo WAR archive from here, rename it to railo.war.
  • Drop railo.war in the Tomcat webapps directory.
  • Watch Tomcat deploy the railo directory in its webapps directory.
  • If you are anal, stop the Tomcat service and remove the railo.war file from the Tomcat's webapps directory. Then start Tomcat again.

If all is good, railo should now show up in the Tomcat application manager and should be able to browse http://localhost:8080/railo/.

Add Virtual hosts

Edit Tomcat/Conf/server.xml and add virtual hosts as needed:

<Host name="www.site1.local"
    appBase="C:/dev/websites/site1.com"
    unpackWARs="true"
    autoDeploy="true"
    xmlValidation="false"
    xmlNamespaceAware="false">
    <Context path="" docBase="C:/dev/websites/site1.com/www" />
</Host>

Drop the war file in C:/dev/websites/site1.com and rename it www. Restart Tomcat, it will create the www directory with its own WEB-INF. Delete the other files that are created as well as the ROOT directory. Stop Tomcat and remove the WAR file.

Check that the Railo admin is available at http://www.site1.local:8080/railo-context/admin/server.cfm.

Setup Apache

Load the required modules to be able to proxy requests from Apache to Tomcat:

LoadModule proxy_module  modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

In the virtual host definition, proxy the requests to Tomcat (with a 24 hours timeout to keep control of the request timeout at the Railo level):

<VirtualHost *:80>
DocumentRoot "C:/dev/websites/site1.com/www"
ServerName www.site1.local
ServerAlias site1.local
ProxyPreserveHost Off
ProxyTimeout 86400
ProxyPassReverse / ajp://www.site1.local:8009/
RewriteEngine On
RewriteRule ^(.+\.cfm.*)$ ajp://www.site1.local:8009/$1 [P]
</VirtualHost>

That should be it. Thanks to the very helpful references:

In: ColdFusion