Three Types of Virtual Hosts are Explained – Name-Based, IP-Based, Port-Based. These Terms Often Create Misunderstanding to the New Users. Right now, we should be talking about Apache 2.4, because there will be some difference in the manual of Apache 2.4 versus Apache 2.6. Types of Apache 2.4 Virtual Hosts, should not be confused with terminologies associated with core of Virtualization, such as Kernel Based Virtual Host. We said that, it is possible to host Multiple Websites, Ubuntu 13.10 running Apache2 Webserver Software. What is Host in Computer Network was also explained in Host in Computer Network.
Types of Apache 2.4 Virtual Hosts : The Basics
As practically the Website Hosting Historically Started With one Computer on One Server; sooner the need to actually split one computer or rather Server to be used by Multiple Websites Started – Mainly to Reduce the Cost. We will not go to much details on individual types of these three virtual hosts but will write about in very short about all these three – Name-Based, IP-Based and Port-Based Virtual Hosts with example of simple your own computer or localhost.
Our Computer or any Computer in this World is localhost and has one reserved IP address – 127.0.0.1 ; be it your Mac, Windows PC or Rackspace Cloud Server; this is constant. 127.0.0.1 is conventionally a computer’s loopback address. Actually all IP addresses in the range of 127.0.0.1 to 127.255.255.255 are reserved for private use.
---
When we add a Network Connection to one Personal Computer or Server; we are getting another unique IP address, we are taking that your Internet Service Provider gives you one IP address. Now you installed Apache 2.4 Web Server Software on your Computer. Tell me, the way how it will be possible for you to use some names like localhost to designate 5-6 different test server environment on localhost? Obviously, subdirectory installation is not a solution.
localhost is the name, 127.0.0.1 is the IP. Again, thecustomizewindows.com is the name, 112.45.89.110 is the IP. For these reasons; gradually three main types of Apache 2.4 Virtual Hosts came to solve the issue. The examples are not perfect but very easy to understand.
Types of Apache 2.4 Virtual Hosts : Name-Based, IP-Based, Port-Based
Name-Based Virtual Host : Name-Based Virtual Host is most easy to configure and probably most commonly used. There are two ways for Apache 2.4 to configure one IP and corresponding one Server to server multiple fully qualified domain names. There is excellent detailed article on Apache’s website :
1 | http://httpd.apache.org/docs/current/vhosts/details.html |
Easiest example of Name-Based Virtual Host is the way we configure Apache2 by editing the /etc/apache2/sites-available/000-default.conf
file.
IP-Based Virtual Host : In IP-based virtual host setup, each of the website points to a unique IP address. Practically it is actually easier to understand, although difficult to configure. Normally we will not use this setup.
Port-Based : Port-Based Virtual Host is quite funny. The default port number for non-ssl HTTP is 80 and corresponding ssl HTTPS is 443. However, most web servers can be configured to operate on almost any port number; the range is actually huge; mainly for configuring control panel of web hosting or for some testing purpose. You can read the article How To Install Webmin System Administration Panel on Rackspace Cloud, you will see that we are asking you to point towards :
1 | https://your-pulic-net-ip:10000/ |
in order to access control panel. Very nicely explained on Official website :
1 | http://httpd.apache.org/docs/2.2/vhosts/examples.html |