ColdFusion Markup Language (CFML) is a programming language designed to allow developers to rapidly create platform-agnostic web-applications. It was born to simplify unnecessarily complex or repetitive procedures. Despite its given name “markup language,” CFML is actually a scripting language. The difference here is that CFML provides the machine with a relatively straight set of logical instructions to run and its purpose is beyond marking up [data] to give structure.
Railo is a ColdFusion Markup Language engine that runs on the Java Virtual Machine (JVM) under a servlet container or an application server. Put simply, it is an application that reads and interprets (parses) CFML (.cfml, .cfm, .cfc) files and executes the given (scripted) commands (instructions) on the go.
In this DigitalOcean article, we will talk about installing and setting up Railo CFML Engine running under Apache Tomcat servlet container with Apache HTTP Server. Afterwards, you will be able to deploy Railo powered CFML web applications and web sites by associating a regular Apache VirtualHost with Tomcat using the provided Tomcat Host example.
It should be noted that since 2008 / 2009, Railo has been an open-source project. It is released under the GNU LGPLv2 license, making it free for everyone to use.
Apache Tomcat is an application which implements Java Servlet Technology. It is also an open-source project, released under the Apache License version 2. Railo ships [Apache] Tomcat with its installation package and we are going to use it with Apache HTTP server and mod_cfml to run CFML applications
mod_cfml is a suite of applications which help greatly when using Apache and Tomcat. Its main goal here is to connect the two and to pass configurations between applications automatically, eliminating a lot of heavy work for setting up web sites.
Please refer to the chart published on the Railo documentation page in order to see how it works (direct link can be found at the end of the article).
In this article, we will be using Apache as the front-facing web server. It is not a strict requirement to have since Tomcat (which is going to handle the CFML execution through Railo) is almost as performant as Apache when serving static files as they both use the same library: Apache Portable Runtime – APR. However, Tomcat’s lack of various HTTP serving needs and Apache’s excellent integration make it the go-to solution for many production level needs.
Please Note: As always, it is recommended to follow these instructions on a new and clean Debian 7 or Ubuntu 13 64-bit VPS instance in order to prevent possible complications, errors etc.
We will start by preparing our VPS, which means upgrading its default components to the latest versions to make sure we have everything up-to-date.
Update the software sources list and upgrade the dated applications:
aptitude update aptitude -y upgrade
Before continuing with installing Railo, we first need to get Apache set up. Later, Railo will use Apache installation to prepare everything else necessary for them to function together.
Install Apache HTTP Server and its dependencies via aptitude:
aptitude -y install apache2
Finally, we are ready to install Railo. The installation process is pretty straight forward; however it requires a few more steps than above.
Let’s begin with downloading the latest available 64-bit Railo installer. As of November 2013, it is version 4.1.1.
Download the file using wget:
wget www.getrailo.org/down.cfm?item=/railo/remote/download/4.1.1.009/tomcat/linux/railo-4.1.1.009-pl0-linux-x64-installer.run -O railo.run
This command will download the file and the “”-O"" flag will have “wget” to name it as “railo.run” for our convenience.
Railo installation requires sudo privileges to run. Therefore, we need to set the file permissions accordingly and make sure that it is executable.
Let’s set the file permission to 744, allowing Owner to “Read, Write and Execute” and the rest just to “Read”.
$ chmod 744 railo.run
The permissions and users can be changed later according to your needs. Please see the documentation for the instructions.
Run the Railo installer to begin the set up:
Upon executing the installer, we will be prompted with several questions, starting with the choice of the installation language. Railo offers several from which you can choose yours.
We will continue with English:
Please select the installation language ... Please choose an option  : 4
Afterwards, the installer will prompt you to read and approve its licensing agreement.
Please read the following License Agreement. You must accept the terms of this agreement before continuing with the installation. ...
Read and accept the licensing agreement:
Press [Enter] to continue : ... Do you accept this license? [y/n]: y
Next is choosing the installation directory.
Press enter to continue with the default:
Please specify the directory where Railo will be installed. Installation Directory [/opt/railo]:
Now we will be asked to provide Railo with the password we want to use. The same will be used both for the Railo Server and Web administration.
Enter a minimum 6 characters long password:
Railo Password Railo Password : Railo Password (confirm) : Press [Enter] to continue :
Railo installer ships Tomcat by default as we have discussed above. In this step, we will be asked to set the ports for Tomcat to use.
Press enter to continue with the defaults or type the ones you require:
Tomcat Ports Tomcat Web Server Port: : Tomcat Shutdown Port: : Tomcat AJP Port: :
Tomcat needs to have a system user associated with it. We will continue with the default which is root. You might want to modify that later depending on your production needs.
Press enter again to set root as Tomcat system user:
Tomcat System User [root]:
Continue with deciding whether or not you would like to have Railo to start at system boot:
Start At Boot? Yes, Start Railo at Boot Time [Y/n]: Y
Since we are going for a default set up, we can accept the configuration options provided upon approving the installation of Apache Connector.
Approve the installation of Apache Connector:
Install Apache Connector? Install Apache Connector? [Y/n]: Y
Choose the defaults by pressing enter for the rest of Apache configurations:
Apache Control Script Location Apache Control Script Location [/usr/sbin/apachectl]: Apache Modules Directory Apache Modules Directory [/usr/lib/apache2/modules]: Apache Configuration File Apache Configuration File [/etc/apache2/apache2.conf]: Apache Logs Directory Apache Logs Directory [/var/log/apache2]:
Enter “Y” and press enter to begin installing Railo:
Setup is now ready to begin installing Railo on your computer. Do you want to continue? [Y/n]: Y Installing 0% ______________ 50% ______________ 100% #########################################
Installation should not take more than a minute or so. After completing, we need to restart Apache.
service apache2 restart
Visit the below URL with your browser to see if everything works correctly. If you have followed all the instructions step-by-step, there should not be any issues.
vps_ip_addr with your server’s IP address:
For the control panels:
Please Note: If you have chosen a port other than 8888 for Tomcat, you will need to use that instead of “8888” as well.
You can now use the default root directory located at /opt/railo/tomcat/webapps/ROOT/ to host your application or opt for creating new [Apache] VirtualHosts to serve multiple websites on the same machine.
In order to add a VirtualHost to Tomcat, you need to modify its server.xml configuration file and add a host item to the
<Engine ..> node.
Open up Tomcat’s server.xml with your favourite editor:
You need to scroll down a bit in order to find the
<Engine ..> node. The host file will need to be appended there.
An example host file to append:
<Host name="your_new_domain" appBase="webapps"> <Context path="" docBase="/location/to/files" /> <Alias>your_new_domain_alias</Alias> </Host>
Please Note: Make sure to replace “your_new_domain” with your domain name and “your_new_domain_alias” with its alias, if it exists, in order to match your existing Apache VirtualHost.
Note : If you do not have any VirtualHosts and you would like to learn more about creating one, please refer to any of the following manuals in order to choose which convention will be best for your needs and follow the instructions.
<div class=“author”>Submitted by: <a href=“https://twitter.com/ostezer”>O.S. Tezer</div>
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.