Virtual web server hosting

61
rate or flag this page
Facebook

By Lucy Dox

Virtual web server hosting, or virtual web hosting as it's often called, is one of the cheapest ways to run a website. Virtual hosting means that the same computer is used to store, or host, several different web sites. This, in turn, spreads the cost of maintaining and updating the computer and its software between the owners of the sites. Each web site is separate from the other sites that are being hosted on the computer.

Most people think of web servers as the physical computers that supply, or "serve", web pages. While that's technically correct, the software that runs on the computer and responds to requests for web pages is also called a web server, and it's the web server software that allows virtual hosting to be set up. A very popular piece of web server software that you may have heard of is the Apache Web Server.

There are two types of virtual hosting: name-based hosting and IP-based hosting. The virtual hosting method that is used is typically specified in one of the configuration files for the web server software, and those files are usually set up and edited by the hosting company that you have signed up with to host your site.

Name-based virtual hosting

Name-based virtual hosting manages the serving of web pages based on the name of the website. By name, I mean the name that you would type in to your search engine, such as www.helloworld.com. The web server software is configured so that the web pages that it serves up depend upon the domain name that is specified in the requests that it receives. For example, a single web server might host the web sites www.example.com and www.test.com. When somebody types the URL www.test.com into the address bar of their web browser, the browser sends a request for the home page of the test.com web site. That request actually contains the hostname "www.test.com", which means that when the web server receives the request it can look in its configuration information to see which web pages it should return, and which directory they are stored in within its filesystem. Similarly, if the web server received a request for a page from the example.com web site, it would use the information that's in its configuration file to see where the example.com web pages are stored. If you were to look in an Apache Web Server configuration file, you might see something like this:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.test.com
ServerAlias test.com *.test.com
DocumentRoot /www/test
</VirtualHost>

<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /www/example
</VirtualHost>

These lines tell the web server that web pages that are part of the test.com website can be found in the /www/test directory in the web server's filesystem. Pages that belong to the example.com domain are in the /www/example directory.

IP-based virtual hosting

IP-based virtual hosting is similar to name-based virtual hosting, except that it uses a numerical address (called an IP address) to determine the web content that it returns. The idea of an IP address is akin to a telephone number. When you want to talk to someone on the phone, you use their phone number to call them. All the computers that are connected to the internet have an IP address. When one computer sends a request to another, it is the IP address that is actually used to "call" that computer on the internet.

An IP address consists of four numbers, separated by dots. For example, at the time of writing this article, the IP address of the web server that's hosting the Wall Street Journal web site, www.wsj.com, is 205.203.140.1. Returning to our example, whenever someone enters www.test.com in the address bar of their web browser, the web browser passes the request to a name server somewhere on the internet. The name server is like a giant telephone directory; it looks at the web address that the user typed (remember that the request contained the string "www.test.com"), and then looks in its database to see whether it contains the IP address for test.com. If the nameserver's database doesn't contain the web server's IP address, then it passes the request to another name server. The request is passed on from name server to name server until the web server's IP address is found. Once the IP address is found, the name server forwards the request to the correct web server. Now, if the web server is configured to use IP-based virtual hosting, it will have one network connection for each web site that it hosts. This could mean that it has one physical network interface per domain name, and each of those network interfaces will have its own IP address. If you were to look in the configuration file for a web server that has been configured to use IP-based virtual hosting, you might see something like this:

<VirtualHost www.test.com>
ServerAdmin webmaster@mail.test.com
DocumentRoot /groups/test/www
ServerName www.test.com
ErrorLog /groups/test/logs/error_log
TransferLog /groups/test/logs/access_log
</VirtualHost>

<VirtualHost www.example.com>
ServerAdmin webmaster@mail.example.com
DocumentRoot /groups/example/www
ServerName www.example.com
ErrorLog /groups/example/logs/error_log
TransferLog /groups/example/logs/access_log
</VirtualHost>


Conclusion

The major advantage of using a virtual web host is that the hosting company is generally responsible for installing the software and applying security updates to it as and when they are released by software vendors. The hosting company usually provides technical support as well.

While virtual hosting is suitable for the vast majority of web sites, there are some exceptions. Some web sites will attract a lot of traffic, and will therefore require higher bandwidth. Hosting companies usually impose a limit on the amount of bandwidth that a virtually-hosted web site can use each month without incurring extra charges. This means that if you have a web site that has lots of visitors, you may have to pay extra to the hosting company.

Comments

No comments yet.

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    • No HTML is allowed in comments, but URLs will be hyperlinked
    • Comments are not for promoting your Hubs or other sites

    working