Apache 2.2 + Tomcat 6 + mod_proxy + ColdFusion... what am I missing here?
ColdFusionI have been working on this problem for more hours... OK days... than I will ever admit, so I thought it might be worth throwing it out to see if anyone can help me get past my disconnect on Apache/Tomcat connectors.
I have installed ColdFusion MX7 under Tomcat 6.0.9 with no problems. It works great, and I can connect to the admin by hitting http://localhost:8080/cfusion/CFIDE/administrator/index.cfm. I have also installed Apache Httpd 2.2.4 with no issues. What I would like to end up with are virtual hosts in Apache Httpd that can connect to specific ColdFusion instances in Tomcat. This is where my problems begin. To the best of my knowledge there are three possible ways for this to work, using mod_jk, mod_jk2, or mod_proxy.
Mod_jk, was the first module that allowed this connectivity, using AJP workers defined in a workers.properties file. Later, mod_jk2 was introduced to solve some shortcomings of mod_jk. Soon however that project died off and mod_jk was still the primary choice. Later (sometime around Httpd 2.0) mod_proxy was introduced that replaced the need for mod_jk, and allow includes some really sweet functionality for load balancing with the mod_proxy_balancer module that extends mod_proxy. So, after tons of googling/blog hunting and reading the Apache email list it appears that the preferred method is currently mod_proxy.
After playing with mod_proxy I was able to successfully create a reverse proxy, in which *anything* that came through on the webserver would be forwarded to my cfusion instance webroot in Tomcat, so that I could then open the admin with http://localhost/cfusion/CFIDE/administrator/index.cfm. This doesn't solve my problem by any means, but the notable thing to me at this point was that I could at least pass requests from httpd to Tomcat which was at felt positive to me. In case this is something you want to do, you can add this to your httpd.conf file.
As I continued down this road, I came across a command you can add in your httpd.conf called RewriteRule, that seems (in theory) to work similarly what the wsconfig application adds into httpd.conf where you can defined file patterns and those that match are sent to be processed. The difference in this case is that it is sent using AJP, which I am having a hard time getting my head around.
After explaining my needs on the Apache email list, someone suggested that I add the following code into httpd.conf file:
This seems to match up with a section of my Tomcat server.xml file that looks like this:
For the life of me though, I can't see how that is supposed to tie to a specific server instance in Tomcat, which is where I think I am missing something that is fairly important. To test this I created a simply test.cfm file in the default webroot with a cfoutput of #Now()#. When restarted httpd (with no errors!) and hit http://localhost/test.cfm, the text of the code is outputted as plain text.
So that is where I am as I write this entry. It is terribly frustrating because I *know* this is possible! I would love to hear from anyone with more knowledge than myself in this area and can point me in the right direction.
I will also come back and update this entry if I make forward progress.





Loading....