Chris Arnold wrote:
I didn't think I needed a second worker but because the working
config only worked for http://share.domain1.com and nothing else, I
wanted to verify it should work or I needed another worker and you
verified I do not need another worker and in fact, the existing
config for http://share.domain1.com should work for
http://share.domain2.com

You definitely don't need a second worker.

Great! I know i am going in the right direction

Why do you need a second VirtualHost, even?
Apache has to answer for that request (http://share.domain2.com)
and pass it to tomcat


Maybe some basic information to clear up things in the first place :

When you work with "virtual hosts", as well under Apache httpd as under Tomcat, the basic principle is this :

When the server receives the request, it examines the request to determine to which "hostname" it is addressed. The server then cycles through all the "hosts" in its configuration, to find one whose declared hostname matches the hostname contained in the request. If it finds one that matches (either on the declared hostname or a declared alias), it "loads the configuration" of that one, to process this request. If it does not find a declared host that matches, then it defaults to its "default host" to process this request.

Both Apache httpd and Tomcat have a "default host", but the way in which this is configured is different in each.

- for Tomcat, it is the host which is declared in the <Engine> tag of rhe "server.xml" file. Usually, this is :
<Engine name="Catalina" defaultHost="localhost">
and later in the server.xml. you will find the corresponding <Host> tag, like :
<Host name="localhost"  ...>

- for Apache httpd, there is no explicity defined default host, but the default host is the first declared VirtualHost (*) matching the port on which the request was received.
(*) from top to bottom of the configuration file, including all the "includes")

So, assuming that all requests which are forwarded by Apache to Tomcat can be processed by the same webapp(s), then you do not need to define any virtual hosts in Tomcat (other than the standard default <Host name="localhost">, because : when Tomcat receives the request, it will look at the host to which it is addressed, and try to match this with the hostname or alias of one of its <Host>'s. Since it will not find any, it will default to the <Host name="localhost"> to process the request, and that's exactly what you want anyway.

It is the same within Apache httpd : if all you want is that your server accepts requests for "hostname1.mycompany.com" and "hostname2.mycompany.com" and processes them in exactly the same way, then all you would need to do is define one <VirtualHost> such that either the ServerName or a ServerAlias matches one of those names (or so that none matches, which would cause the request to be processed by the default host). You /can/ define 2 <VirtualHost>'s, each with the appropriate ServerName, but you don't really have to do that unless you really want some things to happen differently in each.

(which in reality, is likely to happen sooner or later, so maybe you want to bite the bullet now anyway. But that's your choice).


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

Reply via email to