Installing Resin
Please note that you should use the Windows version 3.1.9 from www.caucho.com since the Apache connector included in the Resin 3.1.8 release does implicit chunked encoding which might lead to undesirable results (i.e. content is only 2k long).
In order to install Resin just go to the download page on www.caucho.com and download the latest stable release. In this case it is Resin 3.1.9.
After you have downloaded the archive, just unpack it into a local folder (I have unpacked it under C:\Resin):
Now download the latest Railo JAR files (e.g. railo-3.1.0.012-jars) for a custom installation. You should copy them into the ext-webapp-lib directory. This ensures that you can update to a newer version of Resin quite easily. The folder is configured to keep additional libraries that should be loaded on startup.
Now you have to configure the Railo servlet in order to have Resin execute your Railo CFML files. In order todo so just open the file conf/app-default.xml. Here we need to add the Railo servlet and map it to the .cf* files. So you need to add the following lines somewhere where the servlets are defined (normally after the last <servlet> tag):
<servlet servlet-name="CFMLServlet" servlet-class="railo.loader.servlet.CFMLServlet">
<init-param>
<param-name>railo-web-directory</param-name>
<param-value>{web-root-directory}/WEB-INF/railo/</param-value>
<description>Railo Web Directory directory</description>
</init-param>
<!-- init-param>
<param-name>railo-server-directory</param-name>
<param-value>./</param-value>
<description>directory where railo root directory is stored</description>
</init-param -->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet servlet-name="AMFServlet" servlet-class="railo.loader.servlet.AMFServlet">
<load-on-startup>2</load-on-startup>
</servlet>
After the servlet definition we need to map the *.cf* files:
<servlet-mapping url-pattern="*.cfm" servlet-name="CFMLServlet"/> <servlet-mapping url-pattern="*.cfml" servlet-name="CFMLServlet"/> <servlet-mapping url-pattern="*.cfc" servlet-name="CFMLServlet"/> <servlet-mapping url-pattern="*.cfm/*" servlet-name="CFMLServlet"/> <servlet-mapping url-pattern="*.cfml/*" servlet-name="CFMLServlet"/> <servlet-mapping url-pattern="*.cfc/*" servlet-name="CFMLServlet"/> <servlet-mapping url-pattern="/flashservices/gateway/*" servlet-name="AMFServlet"/>
Then we only have to configure the so-called welcome files. These files are searched when only the directory has been entered in the url. So if you try to call www.getrailo.com in fact www.getrailo.com/index.cfm is executed. They correspond to the default documents in IIS for example.
<!-- Configures the special index files to check for directory URLs --> <welcome-file-list> <welcome-file>index.cfm</welcome-file> <welcome-file>index.html</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>index.php</welcome-file> </welcome-file-list>
If you now restart Resin then Railo should already work. By default the Resin web interface (web server) runs on port 8600 so if you call http://localhost:8600/ Resin should answer already. In order to map a certain application you have written to a certain host, just add the following configuration to the resin.conf:
<!-- configures the default host, matching any host name --> <host id="myapp" root-directory="D:/projects/websites"> <web-app id="/" root-directory="myapp"> <path-mapping url-pattern='/images/*' real-path='d:\images'/> </web-app> </host>
The above configuration tells Resin that it should react on the host named "myapp" and have it point to d:\projects\websites\myapp. In addition a virtual directory named /images is added to the host that points to d:\images. This means that all the requests to http://myapp:8600/images will be executed from d:\images.
Install Apache
Although Resin contains a built in web server, we recommend to use a web server in the following cases:
- production environments
- additional scripting extensions like PHP necessary
- clustered environment
- multi-instance environment
For development purposes we internally use the Resin web server. It is completely sufficient and there is one piece of software that does not needs to be configured.
You can download a 32bit version of Apache from the Apache software foundation homepage.
Some 64bit compilations exist as well but there is no official one yet. We always install the 32bit one and use the 32bit connector at the moment. As soon as there are some official 64bit builds from Apache we will support them as well. The performance impact is not too huge.
Just follow the installation guide and install Apache on port 80. After the installation we need to connect Apache with Resin in order to get the two talking. I assume Apache is installed under C:\Apache.
Therefore we need to edit the file httpd.conf and add the following lines to it:
LoadModule C:\Resin\win32\apache-2.2\mod_caucho.dll
We normally configure our Apache servers to include all host files located inside a certain subdirectory. We normally call it "active". Therfore we add:
include conf/active/*.conf
This directory contains several .conf files that hold the configuration for a certain host. Such a configuration file looks like this:
<VirtualHost *> ServerAdmin webmaster@getrailo.com DocumentRoot "d:/projects/getrailo.local" ServerName getrailo.com.local ErrorLog "d:/logfiles/getrailo.local/error_log.txt" CustomLog "d:/logfiles/getrailo.local/access_log.txt" combined DirectoryIndex index.cfm index.php index.htm index.html index.html.var ResinConfigServer localhost 6800 <Location /caucho-status> SetHandler caucho-status </Location> <directory "d:/projects/getrailo.local/webroot"> Options -indexes multiViews +includesNoExec AddOutputFilter Includes html AllowOverride AuthConfig Order allow,deny Allow from all </Directory> </VirtualHost>
Now Apache routs all unknown files (the ones known to the module) to the loaded module mod_caucho.dll. The line ResinConfigServer tells the module where (to what port) to send all these files for processing. Please do not mix the http port of Resin web server with the internal server port itself which processes the page. The internal port normally is 6800 and the web server port of Resin is 8600. That's why all web servers need to talk to the port 6800 or whatever port is defined in the resin.conf.