Virtual Hosting is a method of hosting multiple domain names (with separate handling of each name) on a single server (or set of servers). This allows one server to share its resources, such as memory and processor cycles, without requiring all services provided to use the same hostname. The term virtual hosting is usually used in reference to the web server but the principles are carried over to other internet services.
One of the most widely used applications is shared web hosting. The shared web hosting price is lower than the dedicated web server because many customers can be hosted on one server. It is also very common for single entities that want to use multiple names on the same machine so that names can reflect the services offered rather than where those services are hosted.
There are two main types of virtual hosting, name-based and IP-based. Virtual based hosting names use the host name presented by the client. This saves the IP address and administrative overhead associated but the protocol being served must provide the hostname at the right point. In particular, there are significant difficulties using name-based virtual hosting with SSL/TLS. IP-based virtual hosting uses a separate IP address for each hostname, and it can be done with any protocol but requires a dedicated IP address per domain name served. Port-based virtual hosting is also possible in principle but seldom used in practice because it is not user-friendly.
Name-based and IP-based virtual hosting can be combined: the server may have multiple IP addresses and serve multiple names on some or all of those IP addresses. This technique can be useful when using SSL/TLS with wildcard certificates. For example, if the server operator has two certificates, one for *.example.com and one for *.example.net, the operator can serve foo.example.com and bar.example.com of the same IP address but need a separate IP address for baz.example.net.
Video Virtual hosting
Name-based
Name-based virtual hosts use multiple hostnames for the same IP address.
The technical prerequisites required for a name-based virtual host are web browsers with HTTP/1.1 support (current common) to include the target host name in the request. This allows the server to host multiple sites behind one IP address to deliver the correct site content. More specifically it means setting the HTTP Host header, which is mandatory in HTTP/1.1.
For example, the server may receive 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 will send the HTML file from the /var/www/user/Joe/site/ directory, while the request for www.example. net will allow the server to serve pages from /var/www/user/Mary/site/. Equally two subdomains of the same domain can be hosted together. For example, a blog server can host blog1.example.com and blog2.example.com.
The biggest problem with name-based virtual hosting is that it's hard to host multiple secure websites running SSL/TLS. Since SSL/TLS handshake occurs before the hostname is expected to be sent to the server, the server does not know which certificate will be displayed in the handshake. It is possible for one certificate to include multiple names either through the "subjectaltname" field or through wildcards but the practical application of this approach is limited by administrative considerations and by matching rules for wildcards. There is an extension for TLS called Server Name Indication, which presents the name at the beginning of the handshake to avoid the problem, except for some older clients (especially Internet Explorer on Windows XP or older Android versions) that do not implement SNI.
Furthermore, if the Domain Name System (DNS) is not working properly, it is difficult to access a virtual hosted website even if an IP address is known. If the user tries to re-use the IP address to contact the system, as in http://10.23.45.67/, the web browser will send the IP address as the hostname. Because the web server relies on a web browser client that tells you what server name (vhost) is being used, the server will respond with the default website - often not the site the user expects.
The solution in this case is to add the IP address and hostname to the client system host file. Accessing a server with a domain name should work again. Users should be careful when doing this, however, because any changes to the actual mapping between hostname and IP address will be overridden by local settings. This solution is not really useful for average web users, but may be useful for site administrators when fixing DNS records.
Maps Virtual hosting
IP based
When IP-based virtual hosting is used, each site (either a DNS hostname or a group of DNS hostnames acting the same) points to a unique IP address. The webserver is configured with multiple physical network interfaces, virtual network interfaces on the same physical interface or multiple IP addresses on a single interface. The web server can open a separate listener socket for each IP address, or can listen in all the interfaces with one socket and obtain the IP address of the received TCP connection after receiving the connection. Either way, it can use an IP address to determine which website will be served. The client is not involved in this process and therefore (unlike name-based virtual hosting) there is no compatibility issue.
The downside of this approach is that the server needs a different IP address for each website. This increases administrative costs (either assigning the address to the server and justifying the use of that address to the internet registries) and contributing to the depletion of IPv4 addresses.
Port-based
The default port number for HTTP is 80. However, most webservers can be configured to operate on almost any port number, provided port numbers are not used by other programs on the server. There is a special HTTP Secure 443 port that requires special configuration (see Server Name Indication). Port-based websites are explicitly tied to unique port numbers and IP addresses. In this case the IP address is used for hosting multiple websites. Unique port numbers used for common IP addresses distinguish individual websites from other websites that are bound to the same IP Address.
Usage
Virtual web hosting is often used on a large scale in companies whose business model is to provide low cost website hosting to customers. Most customer web hosting service websites around the world are hosted on a shared server, using virtual hosting technology.
Many businesses use virtual servers for internal purposes, where there are technological or administrative reasons for operating multiple separate websites, such as extranet websites of customers, employee extranets, internal intranets, and intranets for different departments. If there are no security issues in the website architecture, they can be combined into one server using virtual hosting technology, which reduces management and administrative costs and the number of separate servers needed to support the business.
See also
- Bare-metal server
- Virtual private server
- Server Name Indication
- Shared web hosting service
References
External links
- Apache Virtual Host Documentation
- Which ports are considered unsafe in Chrome
Source of the article : Wikipedia