Recipe 4.12 Displaying the Same Content on Several Addresses

Problem

You want to have the same content displayed on two of your addresses.

Solution

Specify both addresses in the <VirtualHost> directive:

NameVirtualHost 192.168.1.1 NameVirtualHost 172.20.30.40 <VirtualHost 192.168.1.1 172.20.30.40>     DocumentRoot /www/vhosts/server     ServerName server.example.com     ServerAlias server </VirtualHost>

Discussion

This setup is most useful on a machine that has addresses that are internal to your network, as well as those that are accessible only from outside your network. If these are the only addresses, you could use the * notation introduced in Recipe 4.1. However, if there are more addresses, this allows you to specify what content appears on what address.

See Also

  • http://httpd.apache.org/docs/vhosts/



Apache Cookbook
Apache Cookbook: Solutions and Examples for Apache Administrators
ISBN: 0596529945
EAN: 2147483647
Year: 2006
Pages: 215

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net