Quick Nav
NameVirtualHostVirtualHost
See Also
Virtual Host OverviewConfiguration
Configuration Directives
Virtual Host Directives
NameVirtualHost
| Description | Nominates an IP address as using name based virutal hosting
|
| Synopsis
|
NameVirtualHost IPaddr[:port] |
| Context | Default Server |
| Example
|
NameVirtualHost 206.148.97.56
<VirtualHost 206.148.97.56> Â Â ... </VirtualHost> |
-
IP based
-
Name based
The IPAddress argument may be "*" in which case addresses on which Appweb is listening will use name based virtual hosting.
Example of Name Based Virtual Hosting
This example shows two virtual hosts with independent document webs. Both share the same IP address and use the "Host" HTTP header to select the appropriate virtual host.
NameVirtualHost 206.148.97.56
<VirtualHost 206.148.97.56>
  ServerName www.acme.com
DocumentRoot /var/www/acme
...
</VirtualHost>
<VirtualHost 206.148.97.56>
  ServerName www.coyote.com
DocumentRoot /var/www/coyote
...
</VirtualHost>
Example of IP Based Virtual Hosting
This example shows two virtual hosts with independent document webs. Each has a dedicated IP address.
<VirtualHost 206.148.97.56>
  ServerName www.acme.com
DocumentRoot /var/www/acme
...
</VirtualHost>
<VirtualHost 206.148.97.57>
  ServerName www.coyote.com
DocumentRoot /var/www/coyote
...
</VirtualHost>
You can use both IP based and name based hosting on one server.
SECURITY WARNING: You should only ever use an IP address for the argument to the directive. Using a host name will cause a DNS lookup which makes the availability of your web server dependent on the DNS server.
VirtualHost
| Description | Create a directive block that applies to a specific IP address. |
| Synopsis
|
<VirtualHost IPaddress[:port]>
  ... </VirtualHost> |
| Context | Default Server |
| Example
|
<VirtualHost 206.148.97.56:443>
  ServerName www.acme.com   DocumentRoot /var/www/acme   SSLEngine on   .... </VirtualHost> |
If the IPaddress is also specified in a NameVirtualHost directive, the virtual host will use name based hosting. This requires the browser (as nearly all modern browsers do), to include the domain portion of the URL in the HTTP host header. Appweb examines this header and routes the request to the Virtual Host that has a corresponding ServerName, or to
NOTE: Unlike Apache, only one IPaddress may be specified per VirtualHost directive.