tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eldon Olmstead <eld...@ns.sympatico.ca>
Subject Re: URI mapping
Date Sat, 22 Oct 2011 22:37:07 GMT


On 2011-10-22 5:57 PM, Pid wrote:
> On 22/10/2011 17:42, Eldon Olmstead wrote:
>> Thanks for the response Mark,
>>
>> Ok so if I want to keep mod_jk as part of this, ( it is what we use at
>> work ), then if I understand right, I have no choice but to make tomcat
>> support /tomcat7/ in the path. Do I do this just by moving all the
>> webapps under webapps/tomcat7/?
> No.  The appBase (the 'webapps' dir in your case) is not a document root
> like HTTPD, it is the location for your apps - their published paths are
> based on their names (usually).
>
> You would have rename the applications, from:
>
>   tomcat/webapps/app1.war         - http://host/app1
>   tomcat/webapps/app2.war         - http://host/app2
>
> to:
>
>   tomcat/webapps/tomcat7#app1.war - http://host/tomcat7/app1
>   tomcat/webapps/tomcat7#app2.war - http://host/tomcat7/app2
>
> The '#' in the name is translated to a '/' in the path.
OK, so what about the folders that come with Tomcat then? Like ROOT, 
manager, and host-manager? Do I jar those up and name them as 
tomcat7#ROOT.war, tomcat7#manager.war, and tomcat7#host-manager.war?

I just tried creating wars for the above but that doesn't work.

Tomcat's access log is showing apache is passing on the request:
127.0.0.1 - - [22/Oct/2011:18:27:06 -0300] "GET /tomcat7 HTTP/1.1" 404 -
127.0.0.1 - - [22/Oct/2011:18:27:14 -0300] "GET /tomcat7/ROOT HTTP/1.1" 
404 -  ( tried this just in case )
127.0.0.1 - - [22/Oct/2011:18:27:21 -0300] "GET /tomcat7/manager 
HTTP/1.1" 404 -

The apps aren't being found.
>
>
> p
>
>> Will I have to make other configuration changes?
>>
>> What is the right way to do this? The way we have it at work is that
>> each tomcat worker is pointing to one developer's tomcat installation
>> for the developer to do with as they need.
>>
>> On 2011-10-22 1:17 PM, Mark Thomas wrote:
>>> On 22/10/2011 17:11, Eldon Olmstead wrote:
>>>> Hello,
>>>>
>>>> I'm using the following
>>>> Apache2.2
>>>> mod_jk 1.2.32
>>>> Tomcat 7.0.21
>>>>
>>>> I am trying to understand how to configure Apache to allow access to
>>>> Tomcat via mod_jk. I have already made some progress, but have got stuck
>>>> on one point.
>>>>
>>>> Currently, I can access Apache at http://localhost ( works )
>>>> I can also access tomcats default wepapp and the manager and
>>>> host-manager via
>>>>
>>>> http://localhost:8080/
>>>> http://localhost:8080/manager
>>>> http://localhost:8080/host-manager
>>>>
>>>>
>>>> What I want to do next it to connect Apache to Tomcat via mod_jk such
>>>> that the following URLs work
>>>>
>>>> http://localhost/tomcat7/ ( default tomcat webapp)
>>>> http://localhost/tomcat7/manager
>>>> http://localhost/tomcat7/host-manager
>>>>
>>>>
>>>> I have updated the workers.properties with:
>>>>
>>>>      worker.list=tomcat7
>>>>      worker.tomcat7.type=ajp13
>>>>      worker.tomcat7.host=localhost
>>>>      worker.tomcat7.port=8809
>>>>
>>>> I have added the the following in my http-jk.conf that I include in
>>>> http.conf:
>>>>
>>>>      JkMount  /tomcat7/* tomcat7
>>>>
>>>> When I try to access http://localhost/tomcat7, tomcat is given the URI
>>>> /tomcat7/
>>>>
>>>>      127.0.0.1 - - [22/Oct/2011:11:34:20 -0300] "GET /tomcat7/ HTTP/1.1"
>>>>      404 979
>>>>
>>>> So from the above log, I know that apache is forwarding the requests to
>>>> tomcat via mod_jk ok, but tomcat now thinks that /tomcat7/ is now part
>>>> of the request and since there is no tomcat7 web app, it doesn't match
>>>> the request.
>>>>
>>>> I would like http://localhost/tomcat7/ to map to the root of my Tomcat,
>>>> and to be able to access http://localhost/tomcat7/manager,
>>>> http://localhost/tomcat7/host-manager.
>>>>
>>>> What do I do next?
>>> If you want to modify the URL, you'll need to use mod_proxy. Then you
>>> can do:
>>>
>>> ProxyPass /tomcat7 http://localhost:8080
>>> or
>>> ProxyPass /tomcat7 ajp://localhost:8080
>>>
>>> Note that as soon as you start modifying the URL as part of the
>>> ProxyPass you open up a world of opportunity for things to go wrong
>>> (redirects, cookie paths, links). All of these are fixable but it is a
>>> lot easier just to use the same URL structure in both httpd and Tomcat.
>>>
>>> Mark
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message