This is primarily written for myself for posterity, but maybe others might find it useful. I find myself wanting to play with Railo, an Open Source ColdFusion engine. Java on FreeBSD can be quite un-fun, but I’m going to assume a working JDK to start off with.
First thing is to get Apache and Tomcat installed:
cd /usr/ports/www/apache22 && make install cd /usr/ports/www/mod_jk-apache2 && make install cd /usr/ports/www/tomcat6 && make install
Next is to create the /usr/local/etc/apache22/workers.properties file. The mod_jk port gives you a sample to start from. Mine contains:
worker.list=default # The name of the tomcat server worker.tomcat.port=8009 # The port of the tomcat server worker.tomcat.host=127.0.0.1 # The host of the tomcat server worker.tomcat.type=ajp13 # The type of the connection worker.tomcat.lbfactor=1 # The weight of the tomcat server
Then mod_jk needs to be added to httpd.conf:
LoadModule jk_module libexec/apache22/mod_jk.so # Load the mod_jk module # mod_jk basic configuration <IfModule mod_jk.c> JkWorkersFile etc/apache22/workers.properties # Set the worker.properties file JkLogFile /var/log/jk.log # Set the jk log JkShmFile /var/log/jk-runtime-status # Set the status file JkLogLevel error # Set the log level </IfModule>
That was successful in getting Tomcat up and working. Now for Railo. Thankfully, that’s the easy part. Railo provides a WAR file that can easily be dropped into Tomcat’s webapps directory. After that it’s a simple matter of telling Apache what to do about it. I simply added the following to my mod_jk.c’s IfModule:
JkMount /*.cf* default DirectoryIndex index.html index.cfm index.cfml
And hey presto. I also added a
<Host name="domain.com" appBase="/path/to/domain.com"> <Context path="" docBase="www"/> </Host>
And simply extracted the Railo WAR file there instead of in Tomcat’s webapps directory and used it as the basis for the particular site. The only thing is to make sure the web server has appropriate permissions on the WEB-INF directory.