The wild card * can be used for both the IP address and the port number to receive re-
quests on all interfaces. IPv6 addresses must be enclosed in square brackets.
Example 20.1:
Variations of Name-Based VirtualHost Entries
# NameVirtualHost IP-address[:Port]
NameVirtualHost 192.168.3.100:80
NameVirtualHost 192.168.3.100
NameVirtualHost *:80
NameVirtualHost *
NameVirtualHost [2002:c0a8:364::]:80
The opening VirtualHost tag takes the IP address (or fully qualied domain name)
previously declared with the NameVirtualHost as an argument in a name-based
virtual host conguration. A port number previously declared with the
NameVirtualHost directive is optional.
The wild card * is also allowed as a substitute for the IP address. This syntax is only
valid in combination with the wild card usage in NameVirtualHost * . When using
IPv6 addresses, the address must be included in square brackets.
Example 20.2:
Name-Based VirtualHost Directives
<VirtualHost 192.168.3.100:80>
...
</VirtualHost>
<VirtualHost 192.168.3.100>
...
</VirtualHost>
<VirtualHost *:80>
...
</VirtualHost>
<VirtualHost *>
...
</VirtualHost>
<VirtualHost [2002:c0a8:364::]>
...
</VirtualHost>
IP-Based Virtual Hosts
This alternative virtual host conguration requires the setup of multiple IPs for a ma-
chine. One instance of Apache hosts several domains, each of which is assigned a dif-
ferent IP.
The Apache HTTP Server 367