Apache on Ubuntu
Install mod_cfml to Apache on Ubuntu
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
installing Apache on a Ubuntu system can be accomplished with the following commands:
sudo apt-get install apache2 apache2-dev
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
Installing mod_proxy
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:
/etc/apache2/mods-available/proxy.conf
...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, 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.
Installing mod_cfml
Now, after all the preparation, we can finally install our mod_cfml module. If you haven't already, go download the Github mod_cfml-master.zip file. You can download the mod_cfml-master.zip file directly to the server you're installing it on using the "wget" command:
wget -O mod_cfml-master.zip https://github.com/utdream/mod_cfml/archive/master.zip
Next we need to unzip the file. You can do that using the "unzip" command:
unzip mod_cfml-master.zip
Now, go into the unzipped directory "mod_cfml-master/C/", and use the Make program to compile mod_cfml.so, and add it into Apache's modules directory:
cd ./mod_cfml-master/C
sudo make
sudo make install
Now we add our mod_cfml config to Apache. Open this file:
/etc/httpd/conf/httpd.conf
... and add the following config to the very bottom of the file:
LoadModule modcfml_module modules/mod_cfml.so
CFMLHandlers ".cfm .cfc .cfml"
ModCFML_SharedKey "secret key also set in the Tomcat valve config"
# Optional, all for logging and debugging:
# LogHeaders true
# LogHandlers true
# LogAliases true
# VDirHeader false
Again, note that this is configured for CFML requests. You can edit the "CFMLHandlers" 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.