Apache on Ubuntu/Mint/Debian
The following steps cover all the processes necessary to be up and running with mod_cfml on Apache and Ubuntu/Mint/Debian. The steps are intended to be thorough, so you may not need to take each step on your own system. For example, you may already have Apache and some of the required modules installed on your system.
All steps provided are done from the command-line for uniformity. If you have a graphic desktop, you can perform these steps by opening a terminal window and running these commands.
installing Apache on a Ubuntu system can be accomplished with the following commands:
sudo apt-get install apache2
You'll get prompted for a password, then prompted for a confirmation to install. Accept both. Once Apache is installed, you can start Apache with the following:
sudo service apache2 start
Mod_proxy is a connector, that is, it passes the request off to Tomcat for processing. Both mod_proxy and mod_jk have been tested with mod_cfml and both work great. If you already have mod_proxy or mod_jk installed, then you may skip this step.
You can install mod_proxy on Ubunu systems with this command:
sudo apt-get install libapache2-mod-proxy-html
Now enable the modules in Apache (turn them on):
sudo a2enmod proxy proxy_html
Next we need to configure the proxy to send the kind of requests we want off to Tomcat. You do that by editing this file:
and adding the following INSIDE the <ifmodule></ifmodule> tags that probably already exist in the file (as well as a bunch of comments):
<Proxy *> Allow from 127.0.0.1 </Proxy> ProxyPreserveHost On ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://localhost:8009/$1$2
The config above is designed to send any request that Apache gets that has a ".cfm" or ".cfc" in it to be passed off to Tomcat. This configuration is obviously intended for CFML processing engines like Railo or OpenBD, but you can also use a statement similar to the above to pass ".jsp" files off to Tomcat, and mod_cfml will create contexts for those sites as well. Feel free to experiment here however you need to.
Now restart Apache so your changes take effect:
sudo service apache2 restart
Once that's done, requests to something like http://[server-ip]/index.cfm should be working for you.
The mod_cfml.pm module requires mod_perl, so we need to install and enable that module in addition to whatever connector module we're using. To install mod_perl in Ubuntu, run the following command:
sudo apt-get install libapache2-mod-perl2
Now we enable the module in Apache:
sudo a2enmod perl
Then restart Apache to make the new settings take effect:
sudo service apache2 restart
After that, our perl modules will work without a hitch!
Now, after all the preperation, we can finally install our mod_cfml module. If you haven't already, go download the mod_cfml.pm.zip file. You can download the mod_cfml.pm.zip file directly to the server you're installing it on using the "wget" command:
IMPORTANT! The link above points to version 1.0.0 of mod_cfml. Mod_cfml may have been upgraded since this documentation was written, so you may need to use an updated URL.
Next we need to unzip the file. You can do that using the "unzip" command:
and move it to it's permanant home... this can be wherever you want. The following is just an example. I'm going to imagine that I already have a Railo install that I'm now installing mod_cfml into.
sudo mkdir -p /opt/railo/connector/
sudo mv mod_cfml.pm /opt/railo/connector/
Now we add our mod_cfml configs to Apache. Open this file:
... and add the following config to the very bottom of the file:
PerlRequire "/path/to/mod_cfml.pm" PerlHeaderParserHandler mod_cfml PerlSetVar LogHeaders false PerlSetVar LogHandlers false PerlSetVar CFMLHandlers ".cfm .cfc .cfml"
Again, note that this is configured for CFML requests. You can edit the "Handlers" value for the kinds of files that you're sending to Tomcat. (JSP or whatever). By default, mod_cfml will also update the headers on requests for default documents (any request ending in a slash: "/" ), so you don't need to worry about adding that as a handler.
Now that you have the mod_cfml.pm installed, you'll need to install the Tomcat Valve. The Tomcat Valve will take the information that the mod_cfml.pm file is sending it, and create the hosts automatically using that data.