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 <[EMAIL PROTECTED]> 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="my-vhost.domain.com" ...>
<Context docBase="..." path=".."/>
....
</Host>
</Service>

I think the same applies to all other connectors: mod_jk, mod_jk2 and HTTP.

Nix.




-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to