tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Apache 2.2.4 + Tomcat 6.0.9 using mod_proxy for ColdFusion
Date Tue, 13 Feb 2007 17:51:08 GMT
Dave Shuck wrote:
> Sorry, I should have been more clear.  ColdFusion is properly processing files 
> that are in the Tomcat webapp directory.
> Here is where I currently am:   
> If I put a cfm template into my httpd virtual site webroot ex: 
> http://virtualsite1/helloworld.cfm
> /usr/local/apache2/htdocs/virtualsite1/helloworld.cfm
> It will display code in plain text.
> If I then put that same file in 
> /usr/local/apache-tomcat/webapps/ROOT/helloworld.cfm I can access it from 
> http://localhost:8080/helloworld.cfm
> That second one will process the code and display properly.  Just to be clear 
> (and probably redundant), the goal is for that cfm template physically exist 
> in my "virtualsite1" web root.   Additionally I would like to have 
> a "virtualsite2" webroot that had the same behavior.



You can define a series of virtual hosts in the tomcat/conf/server.xml

for each host you should define a ROOT context.
the context xml file lives in the following location(s)



Change the docBase of the ROOT application to match your apache htdocs
path.  The convention is that the default application literally lives in 
a directory called ROOT.  You should rename the Apache directory 
accordingly if you want to mix the files.

I split the directories as follows, with separate apache and tomcat dirs



<Host name="host1" appBase="/sites/host1/webapps" ... >

For your setup, move your whole app into the ROOT dir and alter the 
httpd.conf accordingly.


the Host appBase in tomcat will be:


Tomcat looks for a ROOT application/directory in this location.


> Thanks a lot Pid
> ~Dave
> Thanks...
> ~
> On Tuesday 13 February 2007 03:24:10 Pid wrote:
>> Hi Dave (again),
>> So... your Tomcat context config problem.
>> You've got mod_proxy setup to direct some requests to a Tomcat instance,
>> but you are sending those requests to a Tomcat that doesn't have any cfm
>> files in it's webapp.
>> try putting a single test.cfm (hello world type file) into the tomcat
>> docbase of the ROOT webapp, and then requesting it as normal.
>> /httpd/docs/your/static/stuff
>> /tomcat/webapps/ROOT/your/cfms
>> If we can get that to work, then we'll work out how to fix your app up
>> to get a useable result.
>> p
>> Dave Shuck wrote:
>>> I have been trying to nail down how to configure the combination of
>>> Apache 2.2.4 + Tomcat 6.0.9 using mod_proxy to pass ColdFusion templates
>>> to an instance of a ColdFusion server for processing which is loaded as
>>> an application in Tomcat.
>>> After some very helpful responses from Pid on the apache-users list, I am
>>> furthering my discussion here as it appears that my issue lies with my
>>> misconfiguration (or more aptly un-configuration) of Tomcat to make this
>>> work.   Below is the conversation that brought me to this list.
>>> I am clearly open to the answer of 'rtfm', but I have been thusfar unable
>>> to find the 'm' in which my answer exists.     :)
>>> I would be very grateful for any further advice on this issue.
>>> Dave Shuck wrote:
>>>> I hate to spam up the list with this issue, but I have another question
>>>> if
>>> you
>>>> would indulge me.  To strip this down a bit, let's just forget about the
>>>> multiple instances and say I have a single instance of Tomcat and have
>>>> installed ColdFusion as an application within it.
>>>> So far I have been able to forward .cfm files to ColdFusion via mod_jk
>>>> and ProxyPass, but neither was in the way that I expected.  I haven't
>>>> been able to successfully process cfm files with the RewriteRule method.
>>>>  Perhaps the problem is in my expectation rather than functionality.
>>>> Here is what I would expect to happen.  In Tomcat there is a webapp
>>>> named "ROOT" which is where the ColdFusion web admin tools and such
>>>> installed.  It's physical path is /usr/local/apache-tomcat/webapps/ROOT
>>>> I
>>> can
>>>> hit that with http://localhost:8080/......
>>> ok...
>>>> Then in my httpd-vhosts.conf I
>>>> have a website that is pathed /usr/local/apache2/htdocs/whateversite.  I
>>>> Ideally I want all my files to exist in the .../htdocs/whateversite
>>> directory
>>>> and when I hit a .cfm file in that directory, I want that file to be
>>>> processed by the ColdFusion application.
>>> yes...
>>>> When I used ProxyPass, any request to 'whateversite' would just forward
>>>> the request to the 'ROOT' site and expect the requested file to exist in
>>>> .../webapps/ROOT.    Obviously this wasn't the answer.
>>> that's because you told it to...
>>> when the request comes in, you forward the request to tomcat, which
>>> looked for it in the default application (ROOT) because you haven't told
>>> Tomcat to look anywhere else.
>>> Apache doesn't send the whole file over to Tomcat for processing, it
>>> just abdicates responsibility for the requested url and expects Tomcat
>>> to know what to do with it, and where to find it.
>>>> When I used mod_jk, any non-".cfm" templates would serve properly but
>>>> when
>>> it
>>>> went to serve the ".cfm" templates it would expect those to exist in
>>>> that "ROOT" directory rather in the "whateversite" directory just as
>>>> ProxyPass had.  This was closer but still not the answer.
>>> as above you've not configured your Tomcat to know where those files are.
>>>> I haven't yet gotten your suggestion working using RewriteRule, but 
>>>> would this work as I was expecting where it would not actually re-route
>>>> the
>>> request
>>>> to look for the template in another directory, but actually process the
>>>> requested template through the application?
>>> it doesn't process the file like a filter, a proxy instruction hands off
>>> the request for processing by another server, then feeds the results
>>> back to the client.
>>>> For what it's worth, I added this to the bottom of my httpd.conf file:
>>>> ReWriteEngine on
>>>> RewriteRule  ^\/(.+)\.cfm(.+)? ajp://localhost:8009/$1.cfm$2 [P,L]
>>>> RewriteRule  ^\/(.+)\.cfc(.+)? ajp://localhost:8009/$1.cfc$2 [P,L]
>>>> And this does exist in my Tomcat server.xml:
>>>>     <!-- Define an AJP 1.3 Connector on port 8009 -->
>>>>     <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
>>>> When I put request a ColdFusion template it just serves the plain text
>>>> back from the template sitting in the "whatever" site.  I am not seeing
>>>> any errors, but it just seems to do nothing with that ".cfm" request.
>>>> Again, I feel like I am just missing something that is probably
>>>> painfully obvious to others, but after reading and re-reading through
>>>> the docs I am just not finding the exact answer I am looking for.
>>> Your Tomcat configuration isn't quite right yet.
>>> You need to specify, either a docbase in the ROOT context with all your
>>> cf? files in it, or add another context and direct all requests to that.
>>> ask about configuring Tomcat webapps on the tomcat-user list & I'll look
>>> out for you there.
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail:
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message