Virtual hosting is a method for hosting multiple domain names on a computer using a single IP address. This allows one machine to share its resources, such as memory and
processor cycles, to use its resources more efficiently.
One widely used application is shared web hosting. Shared web hosting prices are lower than a dedicated web server
because many customers can be hosted on a single server.
Name-based virtual hosts use multiple host names for the same webserver IP address. With web browsers that support HTTP/1.1 (as nearly all now do), upon connecting to a
webserver, the browsers send the hostname from the address that the user typed into their browser's address bar along with the requested resource itself to the webserver.
The server can use the Host header field to determine which web site (or virtual host), 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.example.com and www.example.net, both of which resolve to the same IP address. For www.example.com,
the server would send the HTML file from the directory /var/www/user/Joe/site/, while requests for www.example.net would make the server serve pages
from /var/www/user/Mary/site/. Example: A blog server can be hosted using Name base hosting. blog1.example.com and blog2.example.com.