Railo and Apache

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.

Get the Flash Player to see this player.



Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
JohnB's Gravatar 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?
# Posted By JohnB | 18.02.09 10:31
JohnB's Gravatar nevermind, figured it out - looked at the iis config, swiped the modification for resin.conf and tweaked it like;

<host regexp="(.+)">
<host-name>${host.regexp[1]}</host-name>
<root-directory>c:/htdocs/${host.regexp[1]}</root-directory>
<web-app id="/">
<document-directory></document-directory>
</web-app>
</host>

and it's working now
# Posted By JohnB | 18.02.09 10:55
misty's Gravatar 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
# Posted By misty | 20.02.09 21:07
Josef Pichler's Gravatar 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
# Posted By Josef Pichler | 02.04.09 02:42
Jeff Gladnick's Gravatar 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?
# Posted By Jeff Gladnick | 11.04.09 03:41
Johan's Gravatar 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)
<resin xmlns="http://caucho.com/ns/resin";
xmlns:resin="http://caucho.com/ns/resin/core">;
<cluster id="">
<host host-name=" mysite.com ">
<host-alias> mysite.com </host-alias>
<host-alias>www. mysite.com </host-alias>
<root-directory>c:/resin-3.2/webapps/ROOT/mysite</root-directory>
<document-directory></document-directory>
<web-app id="/">
</web-app>
</host>
</cluster>
......... 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
# Posted By Johan | 15.04.09 09:44
Andrew's Gravatar 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.
# Posted By Andrew | 03.06.09 20:39
Reinhard Jung's Gravatar 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?
# Posted By Reinhard Jung | 21.08.09 04:43
Sean Corfield's Gravatar @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.
# Posted By Sean Corfield | 21.08.09 05:35
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner