6:41 pm
5
565
views

Installing Railo with Apache on Windows Server

Recently I had to build a ColdFusion site on a server that didn't have ColdFusion, and what with it's hefty price tag, the admin team weren't in no rush to get a ColdFusion license. So this is when we come up with Railo, an open source alternative to ColdFusion... and I gotta say, in many ways it surpasses ColdFusion!

However, the first issue I came upon was when I tried to install it alongside Apache on my Windows Server 2003 box, the documentation on the Railo site fell slightly short in detailing this. So I had to do some digging myself and finally got it up and running, here is a step-by-step guide for you.

  1. Firstly, install Apache and make all the changes you normally would with your Apache install. I'm not going to detail how to install Apache as it's very simple to do.
  2. Now you want to download Railo. Head on over to the Railo download page and you want to download the Railo Server for Windows .exe file (e.g. railo-3.1.2.001-resin-3.1.9-with-jre-windows.exe).
  3. Stop the Apache server if you have it running, just to make sure that Railo doesn't hit any snags whilst installing. Now run the Railo setup .exe you just downloaded and install it to your server (e.g. D:\railo\). Also take note that Railo should not be installed in a directory containing a space (e.g. C:\Program Files\) in the path name. This is a known issue in the version 3.1.9 of Caucho Resin.
  4. Once Railo has been successfully installed, you should see Railo x.x Server in your services listing on Windows Server. If the Railo server is currently running, stop it, as we need to now tell Apache about Railo before we can get it working.
  5. Open up your Apache config file (e.g. D:\Apache2\conf\httpd.conf) and scroll down to the end of the LoadModule block. Under the last LoadModule add the following
LoadModule caucho_module D:/Railo/win32/apache-2.2/mod_caucho.dll
Take note that the path above must lead to your Railo directory path.
  1. Now you want to edit the VirtualHost of the site that you want to run Railo, so go to the VirtualHost block containing your site (there are several places you could have put this) and add the following (marked in green)
<VirtualHost *:80>
  ServerName sitename.local
  DocumentRoot E:/path/to/site
  ResinConfigServer localhost 6800
  <Location /caucho-status>
    SetHandler caucho-status
  </Location>
</VirtualHost>
The above tells Apache that we want to use Resin and Railo (defaulted to port 6800) for this site.
  1. That's Apache dealt with, now we need to add a small bit of config to the Resin config file to tell it about the site. So open up your resin.conf file (e.g. D:\railo\conf\resin.conf) and do a find for <cluster id="app-tier">. Now find it's matching end tag </cluster> and add the below just before this end tag (so it's inside the <cluster id="app-tier"></cluster>)
<host id="sitename.local">
  <web-app id="/" root-directory="E:/path/to/site"/>
</host>
The above root-directory must match your Apache VitualHost DocumentRoot. It's also worth pointing out that Railo will not see any Application.cfc above this root folder, so you will have to move your Application.cfc in to the top level folder (in this case the E:/path/to/site folder).
  1. That is all the config done, Railo and Apache should now talk to each other and your site should run .cfm pages.

    However, there is one thing I need to point out, leave a few seconds between starting your Railo server and Apache, otherwise you will get Service Unavailable message that won't go away. So start your Railo server, then wait a minute or so and start your Apache server. Open up a browser and go to your Railo website, on initial load you will likely see a 404 page not found message, hit refresh and you will see a Service Unavailable message, then hit refresh again and you should see your site. Strange I know, but as long as it works, who cares, cos you won't see that again.
  2. Now that you have Railo setup, you will likely want to manage the server (just like the ColdFusion administrator), well Railo has a slight difference here, it has an admin page for every app, and a admin page for the entire server, pretty neat huh? The two URL's of these administrators are similar to the below:
Server: http://sitename.local/railo-context/admin/server.cfm
Web: http://sitename.local/railo-context/admin/web.cfm

If you are receiving a lovely 403 error message on your site, then chances are this is because Apache is refusing access to some files. To overcome this, add the following to your VirtualHost block:

<Directory E:/path/to/site> 
  Options +FollowSymLinks
  AllowOverride all 
  Order allow,deny 
  Allow from all 
</Directory>

Don't forget to follow step 8 above again after making this change.

Avatar
At 2:47 am on Mon, 17 May 2010, Pardeep said:

Hi, I've tried 3 times with the above setup on apache 2.2 and Railo with resin. This is the error I'm getting: Railo 3.1.2.001 Error (Missinginclude) Message Page /test.cfm [C:\erailo\webapps\ROOT\test.cfm] not found Java Stacktrace Page /test.cfm [C:\erailo\webapps\ROOT\test.cfm] not found at railo.runtime.PageSourceImpl.loadPage(PageSourceImpl.java:117):117 at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:615):615 at railo.runtime.listener.ClassicAppListener._onRequest(ClassicAppListener.java:35):35 at railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:24):24 at railo.runtime.PageContextImpl.execute(PageContextImpl.java:1709):1709 at railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:261):261 at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:32):32 at javax.servlet.http.HttpServlet.service(HttpServlet.java:91):91 at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:103):103 at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187):187 at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:265):265 at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:436):436 at com.caucho.server.port.TcpConnection.run(TcpConnection.java:682):682 at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:743):743 at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:662):662 at java.lang.Thread.run(Unknown Source):-1 Its frustrating getting Railo up, until it becomes easier I don't see we can give php a run for its money, even though this is a superior solution. Best, Pardeep.

Avatar
At 12:55 am on Wed, 9 Jun 2010, Josh Nathanson said:

Thanks for this guide, was able to get Railo and Apache running wtihout too much trouble.

Avatar
At 12:26 am on Fri, 18 Jun 2010, Josh Nathanson said:

Hey Steve - I recently had to resinstall Railo, and it looks like now the default Resin port has been changed from 6800 to 6802. So in the above Apache virtual host example you might want to make note of that: older config: ResinConfigServer localhost 6800 newer config: ResinConfigServer localhost 6802 To find out which port Resin is using, you need to look in resin.conf for the following line: Hope that helps some folks, I had a devil of a time figuring out why my old Apache settings weren't working after reinstalling Railo.

Avatar
At 12:28 am on Fri, 18 Jun 2010, Josh Nathanson said:

Crap, the code got stripped...let me try again. The line in the resin.conf file is <server id="" address="127.0.0.1" port="6802"/>

Avatar
At 10:29 pm on Tue, 29 Jun 2010, johnandrewsroot said:

Many thanks for the post. Install was flawless on Win2008 server.