919 - 926 - 9847

You do development on Apache+Tomcat+Railo+Adobe CF+Resin+etc

So let's say you support multiple customers, and a mix of Adobe ColdFusion, Railo, and multitudes of J2EE servers.  You want to remain true to the environment you're developing against, so you end up installing all the pieces to make that happen.  At one point, I had ACF 6.x - 8.x installed on my laptop, but for now I just need ACF 9.x and Railo+Resin or Tomcat.

I like to pipe everything through Apache.  I realize that most modern J2EE engines can handle tons of traffic, most still cannot (easily) match the power of mod_rewrite and Apache.

I won't be detailing how you install ACF, or Apache, etc in this post.  I do plan on doing so at some point down the line, but it won't be this post.

Firstly, in your httpd.conf, we set up our Resin/ACF DLLs.


LoadModule jrun_module "<JRUNpath>/lib/wsconfig/1/mod_jrun22.so"
LoadModule caucho_module "<railopath>/win32/apache-2.2/mod_caucho.dll"

Next, make a directory to hold your Apache virtual hosts configs and add this nifty line to your httpd.conf.  Note, this is the windows syntax.  You don't need the *.conf in *nix for whatever reason.


Include <apachepath>/conf/mysites/*.conf

Make a site1.conf in the mysites folder, and this is what it would look like for ACF.


<VirtualHost *:80>
<Directory "<projectpath>\site1">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

alias /CFIDE C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\CFIDE
alias /cfide C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\CFIDE

# JRun Settings
<IfModule mod_jrun22.c>
JRunConfig Verbose false
JRunConfig Apialloc false
JRunConfig Ignoresuffixmap false
JRunConfig Serverstore "C:/JRun4/lib/wsconfig/1/jrunserver.store"
JRunConfig Bootstrap 127.0.0.1:51020
AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf
</IfModule>



DocumentRoot "<projectpath>\site1"
ServerName site1.local
ServerAdmin contact@localhost
ErrorLog <projectpath>\site1\apache_logs\error.log
TransferLog <projectpath>\site1\apache_logs\access.log
</VirtualHost>

For Resin+Railo, it'd look like this for site2.conf


<VirtualHost *:80>
<Directory "<projectpath>\site2">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

ResinConfigServer localhost 6800
<Location /caucho-status>
SetHandler caucho-status
</Location>



DocumentRoot "<projectpath>\site2"
ServerName site2.local
ServerAdmin contact@localhost
ErrorLog <projectpath>\site2\apache_logs\error.log
TransferLog <projectpath>\site2\apache_logs\access.log
</VirtualHost>

For our last example, site3.conf, we'll use Tomcat+Railo


<VirtualHost *:80>
<Directory "<projectpath>\site3">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

<Proxy *>
Allow from 127.0.0.1
</Proxy>

ProxyPreserveHost On
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://localhost:8009/$1$2

DocumentRoot "<projectpath>\site3"
ServerName site3.local
ServerAdmin contact@localhost
ErrorLog <projectpath>\site3\apache_logs\error.log
TransferLog <projectpath>\site3\apache_logs\access.log
</VirtualHost>

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Dominic Watson's Gravatar Neat post (though I see a bunch of special characters in your Tomcat example).

I've been using ajp proxy for a while but using it with mod_rewrite. ProxyPassMatch makes a whole lot more sense!
# Posted By Dominic Watson | 9/16/11 11:31 AM
Matthew Williams's Gravatar That comes from Corfields blog. I've cleaned up those funky chars, not sure what introduced those. I'm just happy I can still use my normal rewrites, but pass all the CFML off to Tomcat.
# Posted By Matthew Williams | 9/16/11 12:00 PM