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:
sudo ./railo.run
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] : 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: [8888]:
Tomcat Shutdown Port: [8005]:
Tomcat AJP Port: [8009]:
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.
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.
Replace vps_ip_addr
with your server’s IP address:
http://vps_ip_addr:8888
For the control panels:
http://vps_ip_addr:8888/railo-context/admin/server.cfm http://vps_ip_addr:8888/railo-context/admin/web.cfm
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:
nano /opt/railo/tomcat/conf/server.xml
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 [2]: 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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
If you, like me, followed this religiously and were getting a ‘browser can’t open this page’ when trying to visit http://vps_ip_addr:8888 , what you want to do is restart railo, which worked for me; $ sudo /opt/railo/railo_ctl restart
This doc is pretty old and when you reach the line to download railo, you’ll get a “can not resolve host” error. This is because railo has since been replaced with Lucee, so here’s what you can do…
Simply replace… 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
with…
wget http://cdn.lucee.org/lucee-5.2.6.060-pl0-linux-x64-installer.run -O railo.run
and the rest of the install will work (with a couple of added steps in the process that you can just follow along as you install)
Once complete the install, you’ll want to replace…
http://vps_ip_addr:8888/railo-context/admin/server.cfm http://vps_ip_addr:8888/railo-context/admin/web.cfm
with
http://vps_ip_addr:8888/lucee/admin/server.cfm http://vps_ip_addr:8888/lucee/admin/web.cfm
or using whatever port you set for tomcat.
Finally, to edit your virtual hosts, simply replace…
nano /opt/railo/tomcat/conf/server.xml
with…
nano /opt/lucee/tomcat/conf/server.xml
(you may need to use sudo nano…)
Hope this helps!
Has anyone tried this since 2014 with more or less success?
Hi,
I have a dilemma. After following these instructions I get these…
domain.com -> points to default html page at /var/www/html. domain.com:8888 -> points to Railo page.
after changing the tomcat server.xml settings,
domain.com:8888 -> points to my CFML app.
I’ve preconfigured my domain for my droplet IP prior to doing this install process. I don’t know if this is a factor.
What exactly must be done to get domain.com to point to my cfml app? I don’t plan to use more than one domain on this droplet.
Thanks!
@adexfe: During the installation process, when you are asked for the Tomcat Web Server port, select 80: <pre> Tomcat Ports Tomcat Web Server Port: [8888]: 80 </pre>
How do i make it work with http://vps_ip_addr:80, asin http://vps_ip_addr, without the port
@sckd: Thanks for the tip!
With mod_cfml, there is no longer a need to define contexts within Tomcat’s server.xml if the new site is configured as an Apache virtual host. When mod_cfml is working properly, it will pass the virtual host details into mod_cfml’s Tomcat valve which will instantiate the Tomcat context on-the-fly.