From 3e3d43d8854b7f9a2f64b3cba8ad9f1c0d116fa7 Mon Sep 17 00:00:00 2001 From: Rich Bowen Date: Wed, 26 Jun 2002 02:31:47 +0000 Subject: [PATCH] Obtained from: IRC, various other conversations A number of people commented that they thought that beginners would find that the IP addresses used in examples did not appear "real" enough. Also, that the ".tld" domain names used in examples were confusing. Examples have been changed to use 172.20 IP addresses, and host names using more recognized tlds. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95886 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/vhosts/examples.html | 139 ++++++++++++++++--------------- 1 file changed, 73 insertions(+), 66 deletions(-) diff --git a/docs/manual/vhosts/examples.html b/docs/manual/vhosts/examples.html index 94c3f32f24..c08a8f288f 100644 --- a/docs/manual/vhosts/examples.html +++ b/docs/manual/vhosts/examples.html @@ -159,8 +159,9 @@ wrong site
-    NameVirtualHost 12.34.56.78
-    <VirtualHost 12.34.56.78>
+    NameVirtualHost 172.20.30.40
+
+    <VirtualHost 172.20.30.40>
         # etc ...
 
@@ -201,9 +202,9 @@ wrong site Setup 1: -

The server has two IP addresses. On one (1.2.3.4), we - will serve the "main" server, and on the other (5.6.7.8), - we will serve two or more virtual hosts.

+

The server has two IP addresses. On one (172.20.30.40), we + will serve the "main" server, server.domain.com and on the + other (172.20.30.50), we will serve two or more virtual hosts.

Server configuration:

@@ -214,14 +215,14 @@ wrong site
     Listen 80
 
-    # This is the "main" server
+    # This is the "main" server running on 172.20.30.40
     ServerName server.domain.com
     DocumentRoot /www/mainserver
 
     # This is the other address
-    NameVirtualHost 5.6.7.8
+    NameVirtualHost 172.20.30.50
 
-    <VirtualHost 5.6.7.8>
+    <VirtualHost 172.20.30.50>
         DocumentRoot /www/example1
         ServerName www.example1.com
     
@@ -229,7 +230,7 @@ wrong site
 
     </VirtualHost>
     
-    <VirtualHost 5.6.7.8>
+    <VirtualHost 172.20.30.50>
         DocumentRoot /www/example2
         ServerName www.example2.org
     
@@ -242,8 +243,8 @@ wrong site
       
     
 
-    

Any request to an address other than 5.6.7.8 will be - served from the main server. A request to 5.6.7.8 with an +

Any request to an address other than 172.20.30.50 will be + served from the main server. A request to 172.20.30.50 with an unknown hostname, or no Host: header, will be served from www.example1.com.

@@ -254,10 +255,10 @@ wrong site Setup:

The server machine has two IP addresses (192.168.1.1 - and 11.22.33.44). The machine is sitting between an + and 172.20.30.40). The machine is sitting between an internal (intranet) network and an external (internet) network. Outside of the network, the name server.example.com resolves to - the external address (111.22.33.55), but inside the + the external address (172.20.30.40), but inside the network, that same name resolves to the internal address (192.168.1.1).

@@ -273,9 +274,9 @@ wrong site
     NameVirtualHost 192.168.1.1
-    NameVirtualHost 11.22.33.44
+    NameVirtualHost 172.20.30.40
 
-    <VirtualHost 192.168.1.1 11.22.33.44>
+    <VirtualHost 192.168.1.1 172.20.30.40>
         DocumentRoot /www/server1
         ServerName server.example.com
         ServerAlias server
@@ -292,12 +293,18 @@ wrong site
     
- + than the fully qualified host name + server.example.com.

+ +

Note also that, in the above example, you can replace the list + of IP addresses with *, which will cause the server to + respond the same on all addresses.

+ +
Note: On the internal + + +

Note: On the internal network, one can just use the name server rather - than the fully qualified host name server.example.com. Note - also that, in the above example, you can replace the list of IP - addresses with *, which will cause the server to respond - the same on all addresses.

@@ -324,26 +331,26 @@ wrong site Listen 80 Listen 8080 - NameVirtualHost 11.22.33.44:80 - NameVirtualHost 11.22.33.44:8080 + NameVirtualHost 172.20.30.40:80 + NameVirtualHost 172.20.30.40:8080 - <VirtualHost 11.22.33.44:80> - ServerName www.domain.tld + <VirtualHost 172.20.30.40:80> + ServerName www.example1.com DocumentRoot /www/domain-80 </VirtualHost> - <VirtualHost 11.22.33.44:8080> - ServerName www.domain.tld + <VirtualHost 172.20.30.40:8080> + ServerName www.example1.com DocumentRoot /www/domain-8080 </VirtualHost> - <VirtualHost 11.22.33.44:80> - ServerName www.otherdomain.tld + <VirtualHost 172.20.30.40:80> + ServerName www.example2.org DocumentRoot /www/otherdomain-80 </VirtualHost> - <VirtualHost 11.22.33.44:8080> - ServerName www.otherdomain.tld + <VirtualHost 172.20.30.40:8080> + ServerName www.example2.org DocumentRoot /www/otherdomain-8080 </VirtualHost>
@@ -357,8 +364,8 @@ wrong site

Setup:

-

The server has two IP addresses (1.2.3.4 and - 5.6.7.8) which resolve to the names +

The server has two IP addresses (172.20.30.40 and + 172.20.30.50) which resolve to the names www.example1.com and www.example2.org respectively.

@@ -371,12 +378,12 @@ wrong site
     Listen 80
 
-    <VirtualHost 1.2.3.4>
+    <VirtualHost 172.20.30.40>
         DocumentRoot /www/example1
         ServerName www.example1.com
     </VirtualHost>
    
-    <VirtualHost 5.6.7.8>
+    <VirtualHost 172.20.30.50>
         DocumentRoot /www/example2
         ServerName www.example2.org
     </VirtualHost>
@@ -397,8 +404,8 @@ wrong site
 
     

Setup:

-

The server machine has two IP addresses (1.2.3.4 and - 5.6.7.8) which resolve to the names +

The server machine has two IP addresses (172.20.30.40 and + 172.20.30.50) which resolve to the names www.example1.com and www.example2.org respectively. In each case, we want to run hosts on ports 80 and 8080.

@@ -408,27 +415,27 @@ wrong site
-    Listen 1.2.3.4:80
-    Listen 1.2.3.4:8080
-    Listen 5.6.7.8:80
-    Listen 5.6.7.8:8080
+    Listen 172.20.30.40:80
+    Listen 172.20.30.40:8080
+    Listen 172.20.30.50:80
+    Listen 172.20.30.50:8080
     
-    <VirtualHost 1.2.3.4:80>
+    <VirtualHost 172.20.30.40:80>
         DocumentRoot /www/example1-80
         ServerName www.example1.com
     </VirtualHost>
 
-    <VirtualHost 1.2.3.4:8080>
+    <VirtualHost 172.20.30.40:8080>
         DocumentRoot /www/example1-8080
         ServerName www.example1.com
     </VirtualHost>
     
-    <VirtualHost 5.6.7.8:80>
+    <VirtualHost 172.20.30.50:80>
         DocumentRoot /www/example2-80
         ServerName www.example1.org
     </VirtualHost>
 
-    <VirtualHost 5.6.7.8:8080>
+    <VirtualHost 172.20.30.50:8080>
         DocumentRoot /www/example2-8080
         ServerName www.example2.org
     </VirtualHost>
@@ -456,30 +463,30 @@ wrong site
 
     Listen 80
 
-    NameVirtualHost 1.2.3.4
+    NameVirtualHost 172.20.30.40
 
-    <VirtualHost 1.2.3.4>
+    <VirtualHost 172.20.30.40>
         DocumentRoot /www/example1
         ServerName www.example1.com
     </VirtualHost>
    
-    <VirtualHost 1.2.3.4>
+    <VirtualHost 172.20.30.40>
         DocumentRoot /www/example2
         ServerName www.example2.org
     </VirtualHost> 
     
-    <VirtualHost 1.2.3.4>
+    <VirtualHost 172.20.30.40>
         DocumentRoot /www/example3
         ServerName www.example3.net
     </VirtualHost> 
 
     # IP-based
-    <VirtualHost 5.6.7.8>
+    <VirtualHost 172.20.30.50>
         DocumentRoot /www/example4
         ServerName www.example4.edu
     </VirtualHost> 
     
-    <VirtualHost 9.8.7.6>
+    <VirtualHost 172.20.30.60>
         DocumentRoot /www/example5
         ServerName www.example5.gov
     </VirtualHost>     
@@ -595,13 +602,13 @@ wrong site
     

Setup:

The name-based vhost with the hostname - www.otherdomain.tld (from our www.example2.org (from our name-based example, setup 2) should get its own IP address. To avoid problems with name servers or proxies who cached the old IP address for the name-based vhost we want to provide both variants during a migration phase.
The solution is easy, because we can simply add the new IP address - (111.22.33.66) to the VirtualHost + (172.20.30.50) to the VirtualHost directive.

Server configuration:

@@ -612,21 +619,21 @@ wrong site
     Listen 80
-    ServerName www.domain.tld
-    DocumentRoot /www/domain
+    ServerName www.example1.com
+    DocumentRoot /www/example1
 
-    NameVirtualHost 111.22.33.55
+    NameVirtualHost 172.20.30.40
 
-    <VirtualHost 111.22.33.55 111.22.33.66>
-        DocumentRoot /www/otherdomain
-        ServerName www.otherdomain.tld
+    <VirtualHost 172.20.30.40 172.20.30.50>
+        DocumentRoot /www/example2
+        ServerName www.example2.org
         # ...
     </VirtualHost>
    
-    <VirtualHost 111.22.33.55>
-        DocumentRoot /www/subdomain
-        ServerName www.sub.domain.tld
-        ServerAlias *.sub.domain.tld
+    <VirtualHost 172.20.30.40>
+        DocumentRoot /www/example3
+        ServerName www.example3.net
+        ServerAlias *.example3.net
         # ...
     </VirtualHost>
 
@@ -661,9 +668,9 @@ wrong site
-    NameVirtualHost 111.22.33.44
+    NameVirtualHost 172.20.30.40
 
-    <VirtualHost 111.22.33.44>
+    <VirtualHost 172.20.30.40>
         # primary vhost
         DocumentRoot /www/subdomain
         RewriteEngine On
@@ -671,7 +678,7 @@ wrong site
         # ...
     </VirtualHost>
 
-    <VirtualHost 111.22.33.44>
+    <VirtualHost 172.20.30.40>
     DocumentRoot /www/subdomain/sub1
         ServerName www.sub1.domain.tld
         ServerPath /sub1/
@@ -680,7 +687,7 @@ wrong site
         # ...
     </VirtualHost>
 
-    <VirtualHost 111.22.33.44>
+    <VirtualHost 172.20.30.40>
         DocumentRoot /www/subdomain/sub2
         ServerName www.sub2.domain.tld
         ServerPath /sub2/
-- 
2.40.0