Hi, all,
First of all, Merry Xmas & Happy New Year!
I'm quite confused about the combination of the "NameVirtualHost" detective and the <VirtualHost> block.
All the Manuals (e.g., [1], [2]) emphasize that "the argument to the <VirtualHost> directive must exactly match the argument to the NameVirtualHost directive." If a NameVirtualHost is defined without corresponding <VirtualHost>, the following information will be shown:
[warn] NameVirtualHost [IP]:[PORT] has no VirtualHosts
My question is on the other side: what will happen when a <VirtualHost> is defined without NameVirtualHost? Some misconfiguration reports (e.g., [3]) can be found that a <VirtualHost> without NameVirtualHost declaration doesn't work. For example, in [3]:
-------------------------------------
...
</VirtualHost>
...
</VirtualHost>
-------------------------------------
However, I cannot replay this case. When I configure my Apache like that, both the two <VirtualHost> works. I checked the source code of different Apache version including Apache 1.3.0, 1.3.42, and 2.2.21. Besides some slight difference, the code of the virtual hosting is quite similar, as follows (see apache-1.3.0/src/main/http-vhost.c or httpd-2.2.21/server/vhost.c):
Step 1. define a hash table: ipaddr_chain **iphash_table_tail[];