tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Turner <tomcat-u...@johnturner.com>
Subject Re: JKMount, virtual hosts, and avoiding the webapp name
Date Wed, 03 Sep 2003 20:28:06 GMT
Mike Curwen wrote:

> 
> I define an Apache Virtual Host in httpd.conf:
> <VirtualHost xxx.xxx.xxx.xxx>
>    JKMount /ATM tomcat1
>    JKMount /ATM/* tomcat1

I wouldn't do /ATM without a wildcard or something after it.

>    DocumentRoot /home/webhome/atm/htdocs/
>    ServerName www.foo.com
>    ServerAlias foo.com
>    ErrorLog /var/log/atm/error_log
>    CustomLog /var/log/atm/access_log combined
> </VirtualHost>
> 
> And in Tomcat server.xml:
> (inside the localhost 'host' element)
> 
> <Context path="/ATM"
> 	 docBase="/home/webhome/atm/"
> 	 defaultSessionTimeOut="60"
>        reloadable="true" >
> </Context>
>  
> 
> So now to access regular static pages with apache, I just say:
> http://www.foo.com/xyz.html
> http://www.foo.com/pages/morepages/foo.html
>  
> And to do servlet/jsp stuff:
> http://www.foo.com/ATM/servletFoo
> http://www.foo.com/ATM/foo.jsp
> http://www.foo.com/ATM/administer/admin.jsp
>  
> This works fairly well, I suppose, but what about sites where MOST
> content is jsp/servlet based?
>  
> I'd like my URLS to not require the /ATM token.

You don't need it.

>  
> So then I thought to do this (in apache):
> <VirtualHost xxx.xxx.xxx.xxx>
>    JKMount /*.jsp tomcat1
>    JKMount /*/*.jsp tomcat1
>    JKMount /servletFoo tomcat1
>    DocumentRoot /home/webhome/atm/htdocs/
>    ServerName www.foo.com
>    ServerAlias foo.com
>    ErrorLog /var/log/atm/error_log
>    CustomLog /var/log/atm/access_log combined
> </VirtualHost>

Double wildcards is "illegal".  "/*.jsp" is equivalent to "/*/*.jsp" 
since the second "/" is covered by the "*" in "/*.jsp".

> But....  how do I match up the requests from apache's virtual host
> www.foo.com to the /ATM context in Tomcat?  Am I looking at creating a
> new <Host> in Tomcat for each <VirtualHost> in apache?

Yes.

> And then the default webapp for each of my TC Hosts would be the /ATM
> application?

You mean sharing Contexts across Hosts?  I don't think so.

Your Context path is just "" with the same docBase.  Then your JkMounts are:

JkMount /*.jsp worker-name
JkMount /something-typically-servlet/* ajp13

John




Mime
View raw message