Now that we've got Tomcat, Railo and Apache httpd up and running, lets connect Tomcat and Apache.
For this we will need a mod_jk connector. The binary can be found here.
There is no x64 connector as there is no x64 official release of Apache httpd, so we will be using the x32 connector. In my case I downloaded mod_jk-1.2.28-httpd-2.2.3.so from the win32 folder. Download this file and put it in C:\Apache2\modules. Now rename it to mod_jk.so
Create a file in c:\Apache2\conf\extra called workers.properties and put this into the file
2 worker.list=worker1
3 # Set properties for worker1 (ajp13)
4 worker.worker1.type=ajp13
5 worker.worker1.host=localhost
6 worker.worker1.port=8009
Now lets download Railo and lets set it up. We want to get the custom one, the jars, in my case "railo-3.1.2.001-jars.zip (34 MB)". Create a Railo folder in the Tomcat folder, in my case "C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0".
Now open up the railo zip file and put the jar files from the railo-3.1.2.001-jars into the railo folder we just created.
Now edit the catalina.properties file that was in Tomcat conf folder, in my case "C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\conf". Find the line that says "common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar" and edit it to say "common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/railo/*.jar"
Now open tomcat-users.xml and change the encoding to utf-8. At the top where it says "<?xml version='1.0' encoding='cp1252'?>" and change it to "<?xml version='1.0' encoding='utf-8'?>" This is needed due to some weird Tomcat bug on windows.
Now lets open web.xml in the Tomcat's conf directory. Just before the "Built In Servlet Mappings" add the following:
2 <servlet-name>RailoCFMLServlet</servlet-name>
3 <description>CFML runtime Engine</description>
4 <servlet-class>railo.loader.servlet.CFMLServlet</servlet-class>
5 <init-param>
6<param-name>configuration</param-name>
7<param-value>/WEB-INF/railo</param-value>
8<description>Configuration directory</description>
9</init-param>
10 <!-- init-param>
11<param-name>railo-server-root</param-name>
12<param-value>.</param-value>
13<description>directory where railo root directory is stored</description>
14</init-param -->
15 <load-on-startup>1</load-on-startup>
16</servlet>
17<servlet>
18 <servlet-name>RailoAMFServlet</servlet-name>
19 <description>AMF Servlet for flash remoting</description>
20 <servlet-class>railo.loader.servlet.AMFServlet</servlet-class>
21 <load-on-startup>1</load-on-startup>
22</servlet>
23<servlet>
24 <servlet-name>RailoFileServlet</servlet-name>
25 <description>File Servlet for simple files</description>
26 <servlet-class>railo.loader.servlet.FileServlet</servlet-class>
27 <load-on-startup>2</load-on-startup>
28</servlet>
Now at the end of the servlet mapping section, add the following
2 <servlet-name>RailoCFMLServlet</servlet-name>
3 <url-pattern>*.cfm</url-pattern>
4</servlet-mapping>
5<servlet-mapping>
6 <servlet-name>RailoCFMLServlet</servlet-name>
7 <url-pattern>*.cfml</url-pattern>
8</servlet-mapping>
9<servlet-mapping>
10 <servlet-name>RailoCFMLServlet</servlet-name>
11 <url-pattern>*.cfc</url-pattern>
12</servlet-mapping>
13<servlet-mapping>
14 <servlet-name>RailoAMFServlet</servlet-name>
15 <url-pattern>/flashservices/gateway/*</url-pattern>
16</servlet-mapping>
17<servlet-mapping>
18 <!-- could be RailoFileServlet -->
19 <servlet-name>default</servlet-name>
20 <url-pattern>/</url-pattern>
21</servlet-mapping>
Now open up server.xml and at the end of the file inside the Engine tag, we'll add a new host definition.
2 <Context path="" docBase="c:/websites/railotest" />
3</Host>
Now lets go back to our httpd-vhosts.conf Apache file. We need to add the following (I do this outside of any virtualhost definitions.
2LoadModule jk_module modules/mod_jk.so
3# Where to find workers.properties
4JkWorkersFile conf/extra/workers.properties
5# Where to put jk shared memory
6JkShmFile logs/mod_jk.shm
7# Where to put jk logs
8JkLogFile logs/mod_jk.log
9# Set the jk log level [debug/error/info]
10JkLogLevel info
11# Select the timestamp log format
12JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
We also need to add the following to the VirtualHost definition
2 JkMount /*.cfm worker1
The full virtualhost definition should look like
2 DocumentRoot "C:/websites/railotest"
3 ServerName railotest
4 ErrorLog "logs/railotest.com-error.log"
5 CustomLog "logs/railotest-access.log" common
6 # Send requests for cfm files to worker named worker1
7 JkMount /*.cfm worker1
8</VirtualHost>
Now if we restart Tomcat and Apache we should be able to hit http://railotest in our browser and see the debugging info. We will also see a WEB-INF folder created inside c:\websites\railotest.
Now lets put in an alias for the railo-context so that we can get to the admin. Inside the virtual host add
Now restart Apache and we should be able to get to the Web Administrator for this host by going to http://railotest/railo-context/admin.cfm