Railo and Apache

May 2, 2008 · By Gert Franz · 19 Comments

In one of my previous entries I have explained how to configure Railo with IIS. This entry will take care about the configuration of Railo and Apache Web Server 2.2.First of all you need to download Railo and Apache from the according locations: Apache 2.2 - MSI download
The global download site of apache can be found under this address: http://httpd.apache.org/download.cgi
Railo 2.0.x - Railo 2.0.1 Server for Microsoft Windows

After having installed both Railo and Apache (just follow the setup wizard) you need to update the httpd.conf in your Apache installation directory. The line you have to enter is:
LoadModule caucho_module <RailoInstallDir>/resin-3.1.x/win32/apache-2.0/mod_caucho.dll If you want Railo to serve all of your virtual hosts then you might add the following lines below the above one: ResinConfigServer localhost 6800
<Location /caucho-status>
SetHandler caucho-status
</Location>
The port 6800 corresponds to the port configured somewhere in the resin.conf like follows <!-- define the servers in the cluster -->
<server id="" address="127.0.0.1" port="6800"/>
Note that this port number has changed from 6800 to 6802 in later Resin versions. So you might want to check the port number before entering it in the httpd.conf. After you have entered the above lines in the two configuration files, you can restart the two services (Railo & Apache). Now the default virtual host already reacts on .cf* files since the mod_caucho.dll tells apache which files it can serve. If you want to server both Railo and maybe CFMX files with the same Apache server, you can include .conf files containing the definitions of the corresponding derver. I always include all .conf files located in an "active" directory. Within these files I define a virtual host and all necessary configuration servers for the necessary modules (In this case mod_caucho.dll). <!-- At the end of my httpd.conf I do the following -->
include conf/active/*.conf
The following example of such an included .conf file configures a new server to use Railo for the defined virtual host: <VirtualHost *>
ServerAdmin info@yourserver.com
DocumentRoot "c:/wwwroot/testproject"
ServerName testproject
ErrorLog "c:/logfiles/testproject/error_log.txt"
CustomLog "c:/logfiles/testproject/access_log.txt" combined
#Welcome files   DirectoryIndex index.cfm index.php index.htm index.html index.html.var #invoking Resin
ResinConfigServer localhost 6800
<Location /caucho-status>
SetHandler caucho-status
</Location>
</VirtualHost>
One thing is to mention. If your server responds to your requests with a 403 error message, you might check the <Directory> entry in your httpd.conf. By default all files are prohibited for access.

Tags: HowTo · Railo 2.0

19 responses so far ↓

  • 1 Jeff Gladnick // May 3, 2008 at 2:16 AM

    Sweet - thats exactly what I was looking for, and I can immediately see where I went wrong.

    Also, something to mull over - blue dragon (and i think Adobe CF) has a button inside of the admin menu where you can automatically wire it into apache/iis. You might consider adding that feature at some point but these guides will tide us over in the mean time.
  • 2 AJ Mercer // May 8, 2008 at 3:16 PM

    See step 4 of
    http://www.railo.ch/blog/index.cfm/2008/4/7/Configuring-IIS6-with-Railo

    I think it is relevant to Apache too
  • 3 Daniel Bleisch // Jun 27, 2008 at 9:46 AM

    Hi Gert,
    is there any howto/installation-guide about how to install railo with
    apache and jboss from the scratch?
    Regards, Daniel
  • 4 Streit Michael // Jun 30, 2008 at 10:05 AM

    i the near future we will make a blog and install guides for this.
    at the moment check out this links:
    http://www.jboss.org/jbossas/docs/
    http://sis36.berkeley.edu/projects/streek/howto/apache-mod_jk2-win.html
    http://today.java.net/pub/a/today/2005/03/01/InstallingJBoss.html
  • 5 Gerald Guido // Sep 10, 2008 at 10:42 PM

    Gert,
    I tried to set up Railo 3 using this method. CF templates are being handled by Rialo but I used the following include (httpd-railo.conf )

    &lt;VirtualHost *:80&gt;
    ServerAdmin info@yourserver.com
    DocumentRoot &quot;c:/xampplite/htdocs&quot;
    ServerName jguido
    ErrorLog &quot;C:/xampplite/apache/logs/error_log.txt&quot;
    CustomLog &quot;c:/xampplite/apache/logs/access_log.txt&quot; combined
    #Welcome files
    DirectoryIndex index.cfm index.php index.htm index.html index.html.var
    #invoking Resin
    ResinConfigServer localhost 6800
    &lt;Location /caucho-status&gt;
    SetHandler caucho-status
    &lt;/Location&gt;
    &lt;/VirtualHost&gt;


    When I try to hit http://jguido/test.cfm on on apache I get this:

    Message Page /test.cfm [C:\Program Files\Railo\webapps\ROOT\test.cfm] not found

    Page /test.cfm [C:\Program Files\Railo\webapps\ROOT\test.cfm] not found
    at railo.runtime.PageSourceImpl.loadPage(Unknown Source):-1
    at railo.runtime.PageContextImpl.include(Unknown Source):-1
    at railo.runtime.listener.ClassicAppListener._onRequest(Unknown Source):-1
    at railo.runtime.listener.MixedAppListener.onRequest(Unknown Source):-1
    at railo.runtime.PageContextImpl.execute(Unknown Source):-1
    at railo.runtime.engine.CFMLEngineImpl.serviceCFML(Unknown Source):-1
    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:175):175
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:240):240
    at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:424):424
    at com.caucho.server.port.TcpConnection.run(TcpConnection.java:481):481
    at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:685):685
    at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:607):607
    at java.lang.Thread.run(Unknown Source):-1


    What am I missing here?
  • 6 Sana // Sep 12, 2008 at 1:09 AM

    Gert,

    Just subscribing to this, because I have same error with Apache connector.
  • 7 Gert Franz // Sep 12, 2008 at 1:42 AM

    @Gerald, Sana
    Just check what Michael Hnat has written in the railo_talk mailing list:
    &lt;start&gt;
    Hi,

    Gerald Guido had an installation issue with Railo3/Resin and Apache.
    He posted his problem in the Railo Blog
    (http://www.railo.ch/blog/index.cfm/2008/5/2/Railo-and-Apache)

    Gerald, I hope you read this. The problem is a missing configuration of the
    resin.conf file.

    In your http.conf you define the DocumentRoot to &quot;c:\xampplite/htdocs&quot;. But
    resins root still points to &quot;C:\Program Files\Railo\webapps\ROOT\&quot;

    So, edit your resin.conf file and look for the

    &lt;host id=&quot;&quot; root-directory=&quot;.&quot;&gt;
    &lt;web-app id=&quot;/&quot; root-directory=&quot; C:\Program
    Files\Railo\webapps\ROOT\&quot; /&gt;
    &lt;/host&gt;

    Entry and change ist to the document root defined in the http.conf.

    Heave fun,
    Michi
    &lt;/stop&gt;
  • 8 dave // Sep 12, 2008 at 3:24 AM

    There are quite a few mac users out here who would like to know about hooking this into apache on os x ;)
  • 9 Gerald Guido // Sep 14, 2008 at 10:53 PM

    Thank you gentlemen.

    I got it up and running and it is working beautifully. I have blog.cfc running on my dev box and it is blazing fast.

    One thing to note is that Apache did not like the space in the path to mod_caucho

    This did not work on vista
    C:\Program Files\Railo3Server\win32\apache-2.2\mod_caucho.dll

    If I moved the DLL or installed Railo to a folder with out a space everything worked fine

    EX: C:\Railo3Server\win32\apache-2.2\mod_caucho.dll
  • 10 Chris // Sep 15, 2008 at 2:49 AM

    Any ideas about apache on linux?
  • 11 JohnB // Feb 18, 2009 at 10:31 AM

    Hi Gert,
    I've just followed these instructions using the latest Railo server version yet I can't get it to serve the files up as defined in my apache vhost config - it always shows the content from C:\Program Files\Railo\webapps\ROOT\index.cfm whichever of my sites I hit.

    Am i missing a step some where?
  • 12 JohnB // Feb 18, 2009 at 10:55 AM

    nevermind, figured it out - looked at the iis config, swiped the modification for resin.conf and tweaked it like;

    &lt;host regexp=&quot;(.+)&quot;&gt;
    &lt;host-name&gt;${host.regexp[1]}&lt;/host-name&gt;
    &lt;root-directory&gt;c:/htdocs/${host.regexp[1]}&lt;/root-directory&gt;
    &lt;web-app id=&quot;/&quot;&gt;
    &lt;document-directory&gt;&lt;/document-directory&gt;
    &lt;/web-app&gt;
    &lt;/host&gt;

    and it's working now
  • 13 misty // Feb 20, 2009 at 9:07 PM

    Hello!
    Been struggling a bit here with railo.

    I have several virtual hosts.

    Everything seems to work as long as I use the numeric IP address to
    refer to my sites.

    For example.....

    Let's pretend I have a domain called website.com and it's IP address
    is 123.456.789.000


    http://123.456.789.000/mysite/index.cfm (works)

    But.........

    http://www.website.com (does not work)

    Can someone help me with this?

    It's proably VERY simple and I'm brain locked.

    thx
  • 14 Josef Pichler // Apr 2, 2009 at 2:42 AM

    if you are in a windows environemnet: maybe a missing entry in the 'hosts' file ?

    127.0.0.1 localhost
    123.456.789.000 website.com

    just a guess,
    good luck, josef
  • 15 Jeff Gladnick // Apr 11, 2009 at 3:41 AM

    Is there a way to use the regex trick if you hostnames do not correllate to the path?

    Like I might have a project called jeff, that is stored in inetpub/wwwroot/cftest

    or something like that?

    Is there a way to just pass everything through from apache so you dont have to go through the trouble of making a new host for each project?
  • 16 Johan // Apr 15, 2009 at 9:44 AM

    I also cannot get the virtual host in Resin to work. Whatever I do I still get to the resin home page.
    Running resin on port 80, all other settings on default, web root at: c:/resin-3.2/webapps/ROOT
    have a website called mysite in c:/resin-3.2/webapps/ROOT/mysite
    Working fine when going to http://localhost/mysite or the equivalent URL with server IP
    Added the domain on the host file - 127.0.0.1 mysite.com
    Going to http://mysite.com takes me to the Resin home page so looks like everything's done ok so far.
    Setting in resin.xml virtual host as follows (here I' must be doing something wrong)
    &lt;resin xmlns=&quot;http://caucho.com/ns/resin&quot;
    xmlns:resin=&quot;http://caucho.com/ns/resin/core&quot;&gt;
    &lt;cluster id=&quot;&quot;&gt;
    &lt;host host-name=&quot; mysite.com &quot;&gt;
    &lt;host-alias&gt; mysite.com &lt;/host-alias&gt;
    &lt;host-alias&gt;www. mysite.com &lt;/host-alias&gt;
    &lt;root-directory&gt;c:/resin-3.2/webapps/ROOT/mysite&lt;/root-directory&gt;
    &lt;document-directory&gt;&lt;/document-directory&gt;
    &lt;web-app id=&quot;/&quot;&gt;
    &lt;/web-app&gt;
    &lt;/host&gt;
    &lt;/cluster&gt;
    ......... the rest of the original xml.........
    Can someone please help with the right code and telling me where exactly to place in the resin.xml file ?

    Thanks
    Johan
  • 17 Andrew // Jun 3, 2009 at 8:39 PM

    I wanted to setup my site like Jeff and have a way to not create a host for each project. I was able to get resin and apache to mirror each other by editing resin.conf (\Railo\conf\resin.conf) and changing the web-app id for the root-directory from webapps/ROOT to C:/wwwroot and that made localhost:8600 (running resin) mirror localhost:80 or just localhost (running apache).

    Obviously not sure how secure this would be in production but good enough for testing stuff out.
  • 18 Reinhard Jung // Aug 21, 2009 at 4:43 AM

    Maybe it's too late. I got Apache installed on port:80 and Railo somehow on port:8600. But how can i an App runnung on port:80? Did i miss some RTFM-Quicksteps?
  • 19 Sean Corfield // Aug 21, 2009 at 5:35 AM

    @Reinhard, sounds like you just haven't got Apache configured to talk to Resin. You should ask some questions on the Railo mailing list - lots of folks have been through this and will be able to help you.

Leave a Comment

Leave this field empty: