0

Apache 2.2 + Tomcat 6 + mod_proxy + ColdFusion... what am I missing here?

ColdFusion

I 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.

tags:
ColdFusion
Dave Ross said:
 
You can't really run multiple "instances" of CF within a single tomcat instance (at least it sounds like you are trying to do that. You want to run a new instance of Tomcat for each CF instance.

It sounds like you got the admin running, but your remaining issue is that you don't want to have the /cfusion/ prefix in front of everything? Just reconfigure the cfusion context path to be "/".

Forget about Mod_Rewrite for now - you shouldn't need that to get it up and running.

Hope that helps - I've never attempted to do exactly what you're doing - I prefer hardware load balancers out in front and then just letting tomcat use APR (which is basically Apache httpd). If you don't need the extra webserver out in front of Tomcat, no need to add additional complexity.
 
posted 1014 days ago
Add Comment Reply to: this comment OR this thread
 
Adam Howitt said:
 
Hey Dave,
I'm not running Tomcat but I have 3 cf instances on my machine I can start and stop to allow me to isolate datasources. I have mm_sites_dev as an instance to connect to my dev SQL box, mm_sites_local to connect to my local SQL box and then another for my personal/non-work stuff which points at various MySQL endpoints. That said, I have at least 8 virtual hosts in apache 2.1 on each instance. It took a while and some plugging through Brandon Purcell's documentation to get it running but it is running for me: http://www.adobe.com/devnet/coldfusion/articles/mu...
. In JRun each instance has a proxy port like 51002 and the entry in my virtual hosts to connect to that instance looks like this:


ServerAdmin me@secretaddress.com
ServerName reactor.local.duodesign.com
DocumentRoot "C:/inetpub/wwwroot/reactor.local.duodesign.com/"
JRunConfig Serverstore "C:/JRun4/lib/wsconfig/1/jrunserver.store"
JRunConfig Bootstrap 127.0.0.1:51004
JRunConfig Apialloc false


The key here is that each virtual host is tied to a bootstrap instance. I'm not sure if this helps you with Tomcat but in JRun, I had to go into the WAR configuration page where it lists the proxies running and make sure it was started.

A different place to look would be your web.xml file in the web-inf directory on your server. For JRun at least, you specify your servlet mappings there:

CfmServlet
*.cfm


Lastly and probably this should have been first, restart apache, restart your cf instance but I'm sure you've done that 18 times already :-)

HTH
 
posted 1014 days ago
Add Comment Reply to: this comment OR this thread
 
Mike Kear said:
 
I might be wrong, but i dont believe CF7 works with Apache 2.2. I believe you have to have Apache2.1.xx. It's a while now since i had this problem, but for me the solution was to dump my latest version of Apache (which was a flavour of 2.2 at the time if I recall correctly) and go down a version or two to 2.0.55.

There was no indication of what the problem was, except that it didnt work. I asked on CF-Talk for help with getting my server going, and as a result was told that i had to have version 2.0.55.

ColdFusion plays very happily with Apache2.0.55 however.
 
posted 1014 days ago
Add Comment Reply to: this comment OR this thread
 
Adam Howitt said:
 
We have 2.2 working at the office with CF7, I can look tomorrow for the config details but it's working.
 
posted 1014 days ago
Add Comment Reply to: this comment OR this thread
 
Mike Kear said:
 
Well Apache2.2 does or does not work with CF7. Ben Forta said on May 18 last year (things may well have changed since then, maybe not):

[quote]
A ColdFusion update is now available to support Apache 2.2 on Linux and Unix (Apache has not yet released a Windows version). Details posted in TechNote. [/quote]

This would seem to imply that if you havent applied the update he refers to (and his link to the technote doesnt work) then it's not going to work.
 
posted 1014 days ago
Add Comment Reply to: this comment OR this thread
 
 
ColdFusion MX 7 does work with Apache 2.2.X. You can read my blog post about it here: http://daveshuck.instantspot.com/blog/index.cfm/20... The issue I believe Mike is referring to is the updated wsconfig that is necessary for creating the JRun connector. Considering that JRun is not in play here, that is not a related issue.

To Dave and Adam, I have a few other comments/questions about the first two comments you guys left, but I have a little more testing to do first so that I don't speak too soon. Thanks for all the comments all.
 
posted 1014 days ago
Add Comment Reply to: this comment OR this thread
 
J Lane said:
 
Dave,

Did you ever get this figured out? I'm having the same problem right now. I've got CF running under Tomcat on a Mediatemple dv server. Everything works great on :8080, but I'd love to serve it through Apache using :80.
 
posted 580 days ago
Add Comment Reply to: this comment OR this thread
 
Andrew Penhorwood said:
 
I too am having this same problem. Surely someone somewhere has figured out how to do this. If you are having this issue and would like to discuss it email me. apenhorwood @ kaleo.biz
 
posted 575 days ago
Add Comment Reply to: this comment OR this thread
 
 
We actually did get this figured out when we walked through the process of using Railo under Tomcat/Apache httpd. Perhaps I can do a write-up of it in the near future.

If you would like to see a very rough list of the steps we took, check out this page:
http://cfopen.instantspot.com/page/CentOS-Server-w...

It is actually instructions for using Smith Project on CentOS, but the same principles apply and you should see where you need to alter your steps. NOTE: Beware of the line in there that says:
# ./configure ? with-apxs=/usr/sbin/apxs

There was a formatting issue in the copy/paste. That should be:
# ./configure --with-apxs=/usr/sbin/apxs

I will try to start working on a blog post about this over the weekend.
 
posted 575 days ago
View Replies (1) || Add Comment Reply to: this comment OR this thread
 
.: HIDE REPLIES :.
GarethE said:
 
Are you still using the reverse proxy? have you found a decent way to share project directories, similar to what can be done using Apache HTTP? Please post how you got this all working. I've got a somewhat usable configuration, but interested in improving it because I have a project that has a public /webroot sub directory and then the rest is in parallel, this was easy with Apache and the Standard coldfusion install, but I can't see how this can be done using Apache and Tomcat.
 
posted 564 days ago
Add Comment Reply to: this comment OR this thread
 
 
@GarethE - Stay tuned. I am actually in the middle of writing a blog entry on setting up Apache/Tomcat/OpenBD on Ubuntu using jk_mod. The process is virtually identical with the exception of the WAR file itself. Hopefully I will finish it tonight and post up.
 
posted 564 days ago
Add Comment Reply to: this comment OR this thread
 
GarethE said:
 
Did you get a chance to complete your blog post on setting up Apache/Tomcat/OpenBD looking forward to reading it.

Cheers.
 
posted 556 days ago
Add Comment Reply to: this comment OR this thread
 
wow gold said:
 
 
posted 210 days ago
Add Comment Reply to: this comment OR this thread
 

Search