[ Team LiB ] |
Recipe 4.5 Mixing Address-Based and Name-Based Virtual HostsProblemYou have multiple IP addresses assigned to your system, and you want to support more than one web site on each address. SolutionProvide a NameVirtualHost directive for each IP address, and proceed as you did with a single IP address: ServerName 127.0.0.1 NameVirtualHost 10.0.0.1 NameVirtualHost 10.0.0.2 <VirtualHost 10.0.0.1> ServerName TheSmiths.name DocumentRoot "C:/Apache/Sites/TheSmiths" </VirtualHost> <VirtualHost 10.0.0.1> ServerName JohnSmith.name DocumentRoot "C:/Apache/Sites/JustJohnSmith" </VirtualHost> <VirtualHost 10.0.0.2> ServerName TheFergusons.name DocumentRoot "C:/Apache/Sites/TheFergusons" </VirtualHost> <VirtualHost 10.0.0.2> ServerName DoriFergusons.name DocumentRoot "C:/Apache/Sites/JustDoriFerguson" </VirtualHost> DiscussionUsing the address of the server, rather than the wildcard * argument, makes the virtual hosts listen only to that IP address. However, you should notice that the argument to <VirtualHost> still must match the argument to the NameVirtualHost with which they are connected. See Also |
[ Team LiB ] |