modjkl...@comcast.net wrote:
Thanks so much Andre for taking the time to help me understand this. It's VERY helpful! I've attached the section of httpd.conf below related to virtual hosts. I think I'm starting to get the picture now. Whatever I input into Adobe's software, I ALWAYS see in the mod_jk.log file the hostname: host3.mydomain.com.
Based on your description below, Apache webserver would select the first virtual host associated
with that name. In this case, the first VirtualHost section below would not 
match
(since xx.xxx.xxx.196 does not match host3.mydomain.com). But I'm guessing the 2nd VirtualHost section below DOES match
(since I interpret * to match anything).

No, you still misunderstand somewhat the meaning of
NameVirtualHost *
and
<VirtualHost *>

I suggest that you re-read the Apache documentation about these,
here : http://httpd.apache.org/docs/2.2/vhosts/name-based.html
but as a kind of shortcut explanation :
"NameVirtualHost *" introduces a "family" of name-based VirtualHost's.
<VirtualHost *> indicates that "this section" is a VirtualHost belonging to that family 
"*".

The "*" is NOT what Apache matches on, when it compares to the request's 
"Host:" header.
What Apache matches on, are the *ServerName* and *ServerAlias* values /inside/ the <VirtualHost> section.

In that sense, the "*" in NameVirtualHost and <VirtualHost> is just a common label, like the "family name". If you change the "*" to for example "*:80", then you should change it in both the NameVirtualHost AND all corresponding <VirtualHost> lines. They must always match exactly.

In yet another way to say this :

NameVirtualHost *
introduces a family of
<VirtualHost *>
that answers on all the IP addresses of the server, and all ports on which Apache listens (as per the "Listen" directive(s)).

NameVirtualHost *:80
introduces a family of
<VirtualHost *:80>
that answers on all the IP addresses of the server, but only on port 80 (on which Apache is supposedly listening).

NameVirtualHost 1.2.3.4:80
introduces a family of
<VirtualHost 1.2.3.4:80>
that answers only on the interface that has 1.2.3.4 as an IP address, and only on port 80 (on which Apache is supposedly listening).

etc..

In the vast majority of cases, you would want all your VirtualHost's to be available on all the interfaces of your server, and all ports on which Apache is "Listen"-ing.
So you would use only
NameVirtualHost *
<VirtualHost *>

Only if you have a good reason, should you start "limiting" a family of VirtualHost's to only one specific IP address and/or port of the server.
And when you mix both, such as
NameVirtualHost 1.2.3.4:80
NameVirtualHost *:80
as you are doing, then it becomes more complicated to figure out in which order Apache is going to evaluate this in order to find a VirtualHost which matches a request. For example, if a request comes in on the interface with IP 1.2.3.4, is Apache going to try matching the ServerName's in the <VirtualHost 1.2.3.4> sections (because the IP matches), or in the <VirtualHost *> sections (because the "*" also matches the IP 1.2.3.4) ?

So don't do that unless you have a specific reason to do it.

This is fast becoming an Apache httpd forum...
On the other hand, it is rather important to understand these things, in order to know which JkMount applies to which host, which is at the root of your mod_jk issues.


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

Reply via email to