tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Turner <>
Subject Re: Virtual domains with Tomcat
Date Mon, 23 Jun 2003 15:25:17 GMT


As I understand it, the JK/JK2 connectors are pipelines, not pre-or post- 
processors.  They send the request from Apache to Tomcat.  When Tomcat 
receives the request, it is as if Apache doesn't even exist.  Tomcat acts 
the same way it would act if using Tomcat stand-alone.  I could be wrong, 
but I've never been able to successfully setup a virtual hosting 
configuration without defining my virtual hosts in both Apache's httpd.conf 
and Tomcat's server.xml.  If there's a shortcut, I'd love to see it.


On Mon, 23 Jun 2003 10:59:33 -0400, Rick Anderson 
<> wrote:

> When you use virtual hosts on apache2 with mod_jk2 does Tomcat have to 
> have the same virtual hosts defined in it's server.xml file?
> --Rick Anderson
> John Turner wrote:
>> Yes.  In general, for every Apache ServerName, you need a corresponding 
>> Host entry in Tomcat's server.xml.
>> The Apache connectors are just pipelines, they do not do any work on 
>> behalf of Tomcat.  Thus, when Tomcat receives the request, it has to do 
>> the same sort of host header processing that Apache has to do.  If 
>> Tomcat cannot find a Host entry that corresponds to the HTTP Host Header 
>> it is receiving on the request, it will default to the host name listed 
>> in the defaultHost parameter in server.xml.  Apache does the same 
>> thing...if it can't find a VirtualHost to match the host header, it 
>> defaults to the global VirtualHost, or rather the global ServerName.
>> The syntax for defining a virtual host in Tomcat's server.xml is 
>> different than Apache's httpd.conf, but the principles and concepts are 
>> the same.
>> John
>> On Mon, 23 Jun 2003 11:00:58 +0200, Nikola Milutinovic 
>> <> wrote:
>>>> How can I get Tomcat to recognize virtual domains?  This is trivial 
>>>> with Apache and I can get Apache to fetch the correct jsp but I cannot 
>>>> get timcat to process it.  If I turn off tomcat, apache sends the jsp 
>>>> source.  If I turn tomcat on, I get the error 404 page
>>> Anything in the logs?
>>> I'm not totally sure, but I think you need to match VHosts in your 
>>> Apache and your Tomcat. I'll be testing exactly that today with 
>>> mod_jk2, Apache 2.0.46 and Tomcat 4.1.24. For mod_webapp it is definite 
>>> - you need:
>>> <Service ...>
>>> <Connector ...>
>>> <Engine ...>
>>> <Host name="" ...>
>>> <Context docBase="..." path=".."/>
>>> ....
>>> </Host>
>>> </Service>
>>> I think the same applies to all other connectors: mod_jk, mod_jk2 and 
>>> HTTP.
>>> Nix.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Using M2, Opera's revolutionary e-mail client:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message