Newbie’s perspective on Rialo


So I finally made the leap from Adobe ColdFusion 8 to Railo. I setup a Linux (CentOS) VM running Apache & Railo. It took a little bit getting use to the layout and where and what to configure. But it seems all you need is just two extra steps, configuring the server.xml and web.xml files for tomcat. If you use tomcat already you mostly likely knew this…

I downloaded the Railo installer – making the installation much easier running smoothly both in the GUI and on the terminal. The installer automatically configures your Apache configuration file (httpd.conf) with the following.

	<IfModule !mod_jk.c>
		LoadModule jk_module /usr/lib/httpd/modules/mod_jk.so
	</IfModule>
		
	<IfModule mod_jk.c>
		JkMount /*.cfm ajp13
		JkMount /*.cfc ajp13
		JkMount /*.do ajp13
		JkMount /*.jsp ajp13
		JkMount /*.cfchart ajp13
		JkMount /*.cfres ajp13
		JkMount /*.cfm/* ajp13
		JkMount /*.cfml/* ajp13
		
		# Flex Gateway Mappings
		# JkMount /flex2gateway/* ajp13
		# JkMount /flashservices/gateway/* ajp13
		# JkMount /messagebroker/* ajp13
		JkMountCopy all
		JkLogFile /var/log/httpd/mod_jk.log
	</IfModule>

If you use a framework like Mach-II or Blogger/CMS package like Mura you will need to add a servlet-mapping in the web.xml file found in {railo}/tomcat/config/. This just needs to be added once, and it will work across all your sites. I generally place it after the *.cfc mapping.

	<servlet-mapping>
		<servlet-name>CFMLServlet</servlet-name>
		<url-pattern>/index.cfm/*</url-pattern>
	</servlet-mapping>

To configure your site you will need to setup Apache to point to the files not rendered by Tomcat (i.e. image, css, jQuery/JavaScript files). On my VM machine I created one VirtualHost file and pointed the VirtualDocumentRoot to my project folder. You will notice I have %0 at the end, this is a quick way to have the folder served as the root of a site and not having to explicitly define each website (e.g. http://mura.centos.localhost will point to the mura.centos.localhost folder)

	<VirtualHost *:80>
		ServerName eth0
		VirtualDocumentRoot /mnt/hgfs/Sites/Projects/%0
		DirectoryIndex index.cfm index.html
		
		LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
		
		CustomLog logs/access_log combined
		ErrorLog logs/error_log
		Alias /mods /usr/share/doc/mod_security-2.5.9/doc
		
		Alias /libraries /mnt/hgfs/Sites/libraries
	</VirtualHost>
 

At the moment I don’t know of any tricks to do this with Tomcat so you will need to explicitly define each site in your server.xml file.

	<Host name="mura.centos.localhost" appBase="webapps"
		unpackWARs="true" autoDeploy="true"
		xmlValidation="false" xmlNamespaceAware="false">
		
		<Context path="" docBase="/mnt/hgfs/Sites/Projects/mura.centos.localhost/" />
	</Host>
 

After this all you need to do is restart your services for httpd and railo.

Leave a Reply