Setting up Apache, OpenBD, Railo and ColdFusion - Part 4 - Installing Railo under Tomcat with Apache webserver

ColdFusion, Servers

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 downloading
the 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....

dave said:
 
The issue I have been having is setting up the individual sites(railo), I'm not sure if you need to deploy a war in each one or what I was thinking is that your vd worker file should hand the request off to tomcat when it finds a cfm file and runs it that way with a central install (railo).

But when I do that and run the site I get a railo error about no index.cfm file in the railo admin but it is there and if you hit up the railo admin it runs.

 
posted 284 days ago
View Replies (2) || Add Comment Reply to: this comment OR this thread
 
.: HIDE REPLIES :.
 
I know of no other way besides having the extracted WEB-INF directory in each site. For our purposes, however, the WEB-INF becomes a part of the source of our application, as we tend to customize things within it that are specific to our applications.
 
posted 284 days ago
Add Comment Reply to: this comment OR this thread
 
Dom said:
 
I've just blogged about getting somewhere close to a single Railo install for multiple sites ( single Tomcat host for multiple sites ). Could be useful. Great posts Dave, I've returned here often.

http://fusion.dominicwatson.co.uk/2009/11/multiple...
 
posted 11 days ago
Add Comment Reply to: this comment OR this thread
 

Search