There are three types of virtual hosting.
- IP Based Virtual Hosting (not commonly used)
- Port Based Virtual Hosting (not commonly used)
- Name Based Virtual Hosting (commonly used)
a. IP Based Virtual Hosting:
IP based virtual Hosting is the method to run multiple websites on a single machine, but each website must be configured to run on a different/unique IP. To configure the IP base virtual hosting we have to assign multiple IPs to the machine(server).
Say we have a "Dell Precision 650" machine, to host 3 different websites we must assign 3 unique IP addresses to the machine, and then configure each website to listen on a dedicated IP.
Just a single physical machine will host multiple websites, otherwise we need a separate machine to host each website.
Requires a dedicated IP for each website.
b. Port Based Virtual Hosting:
Port base virtual Hosting is the method to run multiple websites on a single machine and even on a single/same IP, but each website must be configured to run on a different/unique Port.
Say we have a "Dell Precision 650" machine, to host 3 different websites we just need a single dedicated/unique IP-add.
e.g we have to host www.test.com, www.wxyz.com, and http://www.ijkl.comon a single machine using single/same IP-addr… we will configure http://www.test.comto listen on port 81, http://www.wxyz.comto listen on port 82, and http://www.ijkl.comto listen on port 83.
Just a single physical machine and IP will host multiple websites. No need to purchase multiple machines and IP-add to host multiple websites.
– It is quite impossible to inform the users/surfers that on which particular port the website is hosted.
– And user/surfer must has to type the particular port in the url e.g
- To access the www.test.com, in the url user/surfer has to type the port too, as www.test.com:81
- To access the www.wxyz.com, in the url user/surfer has to type the port too, as www.wxyz.com:82
- To access the www.ijkl.com, in the url user/surfer has to type the port too, as www.test.com:83
c. Name Based Virtual Hosting:
To run multiple websites on a single machine and even on a single/same IP and port, we have to configure the Name-Based Virtual Hosting.
A single machine, single IP, and the default http port(80) is used to host several websites.
Proper DNS configuration will be required to host and access the websites hosted via Name Base Virtual Hosting.
Note: Since other types of Virtual Hosting(IP and Port base) are not commonly used, thats why we just discuss the Name-Based virtual hosting and used the term "Virtual Hosting" for Name-Based Virtual Hosting.