Name-based virtual hosts use multiple host names for the same webserver IP address. This post show how you can create name-based virtual hosts using the iisweb command-line utility.
With web browsers that support HTTP/1.1 (as nearly all now do), upon connecting to a webserver, the browsers send the address that the user typed into their browser's address bar (the URL). The server can use this information to determine which web site, as well as page, to show the user. The browser specifies the address by setting the Host HTTP header with the host specified by the user. The Host header is required in all HTTP/1.1 requests.
For instance, a server could be receiving requests for two domains, www.site1.com
and www.site2.com
, both of which resolve to the same IP address. For www.site1.com
, the server would send the HTML file file from the directory /var/www/user/Joe/site/
, while requests for www.site2.com
would make the server serve pages from /var/www/user/Mary/site/
.
To create a virtual host on a Microsoft IIS 6 web server, you can use the following command on the command line:iisweb /create "C:\Inetpub\VirtualHosts\www.vanstechelman.eu" www.vanstechelman.eu /d www.vanstechelman.eu