Here are rules we found yesterday… the ones I can reconstruct. —Owen
“aggregate config” == the merge of all “modular” config files
- VirtualHost directives with port arguments () must be preceded by exactly one NameVirtualHost of the same port (:80)
- more than one entry of NameVirtualHost for a particular port in the aggregate config results in complaints about extraneous NameVirtualHost
- missing NameVirtualHost results in complaint about a VirtualHost entry taking “precedence”
- If a “NameVirtualHost “ is defined, then NO VirtualHost directive can designate a port; otherwise, you get complaints of extraneous NVH. (N.B. This may be implied by the Apache Httpd 2.0 documentation about how VirtualHost must exactly match corresponding NameVirtualHost). Implication: If a “NameVirtualHost *” is changed to one that designates a port, such as “NameVirtualHost *:80”, then no VirtualHost in the aggregate config can have the “” argument. (might require at least one more test to confirm)
- NameVirtualHost must be defined before any VirtualHost directives. Implication: vhost file names should sort such that this rule is true. (might require at least one more test to confirm)
- Only one default: combination for VirtualHost directive
- For a port, if only the default VirtualHost is defined, no NameVirtualHost is required. As soon as a second VirtualHost for the same port is defined, then a NameVirtualHost is required, and must obey rule #2.