Setting up Apache, OpenBD, Railo and ColdFusion – Part 4 – Installing Railo under Tomcat with Apache webserver
This is Part 4 in an ongoing series demonstrating how to install OpenBlueDragon, ColdFusion, and Railo concurrently with all requests passing through the Apache webserver. You will find links to all parts of this series at the bottom under “Related Content”
In this post we will be building upon our existing environment in which we installed Apache webserver, Tomcat 6, OpenBlueDragon, and ColdFusion, by adding Railo to the mix. If you have been following along thus far, we are well past the hard stuff at this point. To install Railo, which is deployed as a java war file, we are going to repeat and slightly modify many of the steps that we took at the end of Part 2 when we installed OpenBD as a Tomcat web application.
Let’s start by setting up our hosts entry so that our new site resolves to localhost.railo, and set up the Apache webserver to listen for the request. Open up /etc/hosts, and append ‘localhost.railo’ (without quotes!) to the line that begins with 127.0.0.1. Next we want to create a new virtual host file for the site under Apache. Do so like this:
$ cd /etc/apache2/sites-available sudo gedit localhost.railo
Paste the following into that new file and save it.
<VirtualHost *> ServerName localhost.railo JKMount /* worker1 </VirtualHost>
As we learned in Part 2, the line “JKMount /* worker1″ is instructing apache to pass everything to the worker we defined in /etc/apache2/workers.properties. That worker will then pass the request on to Tomcat port 8009, under which our application actually resides.
Now that we have defined this site, we want to make sure that it gets included on our next Apache restart. We do this by running the following:
$ sudo a2ensite localhost.railo Site localhost.railo installed; run /etc/init.d/apache2 reload to enable.
At this point, we need to make sure there is a an application set up in Tomcat to receive our request. First, let’s start by downloadingthe free Railo Server from their download page. Look toward the bottom of the page and download “Railo Custom” and download railo-3.0.2.001.war. (or newer version if it is there). Once we have the file downloaded, we will create a new directory for our application under Tomcat. We will then copy the Railo war file into it from our download directory. When we have the war file under /opt/tomcat6/webappas/localhost.railo/ we will extract it, and then safely delete the war file itself. These steps can be seen here:
$ sudo /opt/tomcat6/webapps/localhost.railo sudo cp railo-3.0.2.001.war /opt/tomcat6/webapps/localhost.railo/ cd /opt/tomcat6/webapps/localhost.railo sudo jar xvf railo-3.0.2.001.war sudo rm railo-3.0.2.001.war
Since we now have the application in place, it is time to modify the Tomcat server config so that it knows to send the appropriate requests to it. Do the following:
$ sudo gedit /opt/tomcat6/conf/server.xml
Look for the section that we added previously for our OpenBlueDragon localhost site “localhost.bd”. We are going to copy that section, modifying the “name” and “docBase” attributes to match our new application and paste it just below the localhost.bd site. When you are done they should look like this:
<Host name="localhost.bd" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="true" xmlNamespaceAware="false"> <Context path="" docBase="localhost.bd/" reloadable="true" privileged="true" antiResourceLocking="false" anitJARLocking="false" /> </Host> <Host name="localhost.railo" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="true" xmlNamespaceAware="false"> <Context path="" docBase="localhost.railo/" reloadable="true" privileged="true" antiResourceLocking="false" anitJARLocking="false" /> </Host>
With all that done, we are ready to restart (or start) Apache, Tomcat and our new Railo site will be available at http://localhost.railo
So with our original goal of being able to run the three CFML engines, it’s time to see how we did….
http://dl.getdropbox.com/u/101948/blog/movies/3-cfml-engines.swf
