If we are a regular user of the internet, we might have wondered, at some point of time that how does the web pages that we see in our internet browser is brought to us. We might have wondered ever, that how does this all work. Well, the answer to all such kinds of questions fairly sums upon the term “Web Server”. A web server is a service, either hardware or software, that uses the Client-Server Model and the Hyper Text Transfer Protocol (HTTP) to serve the data or files from the web to the web users. Too many technical terms?
In simple words, a web server is a service that fetches you the web pages, you see on your computer screen. A web server can either be a dedicated hardware or a piece of software. Web Servers are primarily used for hosting websites across the world. Although they do have other purposes like online gaming, data storage and running enterprise applications. Primarily the web servers can be said to be serving the content, although they also feature dynamic client side or server side scripting which allows receiving content from the client as well.
A web server is essentially a computer program which is responsible for handling HTTP requests. Let’s get the basic idea. A browser requests to view a page from the web server. The server then accepts the requests and displays the web page. So, web servers can be considered as the storage area for files which are available on the web. So technically to view any web page from any part of the world, the page must be loaded on to a web server. Let’s convolute a little bit. Suppose we want to open a specific web page. We key in the address of the website in the browser’s address bar. Here let us take an example that the address is http://fitnytech.com/design.html. The browser first breaks the URL into three parts which are:
- http protocol
- The web domain “www.fitnytech.com”
- The specific file “design.html”
- Now the browser knows that it has to use the http protocol. Next, the browser finds a domain name server for the web domain stated above and translates “fitnytech.com” into an IP address since IP address is what is the actual address of the domain on the web server and we need to communicate with it. All the files for the domain are stored inside the secondary storage of the server. The browser establishes a connection with the web server from some specific port. Now, the browser sends a GET method to the server for the file “design.html”.
GET /design-wlan.html HTTP/1.1 Host: www.fitnytech.com
Accordingly, the server sends the html file back to the browser. The web browser then renders the page and hence the page is displayed on the screen of our computer. This must have left people wondering, so much so for viewing a simple web page!
Modes in Web Server
A web server can either be implemented into the OS Kernel or in the user space. An in-kernel web server generally is faster than the user space implementation because it can independently use all the hardware resources directly. Some of the examples of this include Microsoft IIS (Internet Information Services) on Windows or TUX (Tuxedo) on Linux. However, in user space implementations, servers are run like any other regular application and they need permission for seamlessly using the CPU resources hence making them slower than in-kernel implementation.
Machines connected to the internet can be broadly classified into two categories viz. Client and the Server. A machine can qualify as a server machine if it is providing any sort of services to other machines on the network. On the other hand, if a machine is not providing any services to any other machine, it is a Client. For example, Gmail is a server as it hosts mailing facilities for all the users around the world. So Gmail might be having a lot of machines which as a combination work as a server.
The machines which connect to Gmail to avail these services are the clients of Gmail. Web server is a kind of server that host web files for the internet. Similarly, there can be other servers like POP3 server or FTP server etc. A pre-requisite for a machine to be a server is that it should always be in ON state as many clients around the world might be accessing files from that server at any point of time. So is it is turned off, the services will not be accessible to the client.
Web servers make their services available to the clients by hosting their services on specific port numbers. A web server can feature more than one service for its clients and hence it provides these services on different ports. So, when a particular service is required to be accessed, only the corresponding port is accessed at the server. For example: a web server can provide features like WWW along with SMTP (Simple Mail Transfer Protocol). So it will make WWW available on port 80 and SMTP on port 25. Here is a list of some commonly used services with their default port numbers:
|Service Name||Port Number|
Usually, the web browsers append the web URLs with the port number according to the specified service. But if we want to specify the port number explicitly we can do that as well. Let us say that we want to access a service hosted on the server “abc.com” at port number 33. So we can key in the address bar the following address “http://www.abc.com:33”. When no port is specified, the browser defaults the port to 80.
Once the user is connected to a server, it interacts with the servers using a protocol. A protocol defines the way how the user is interacting with the web server. We all have read in our computer books at school that protocol is a set of rules. Well, that’s pretty much it. There is no better definition for it. Let us take an example here. A host connects to a server that supports TIME protocol at port 37. What time protocol does is sends back a site-independent, machine readable date and time and then closes the connection. The server sends the time as a 32-bit unsigned integer in binary format and in network-byte order, representing the number of seconds since 00:00 (midnight) 1 January 1900 GMT.
Thank You for reading this article. We hope you enjoyed it.
This information can be useful for someone in your circle. Share with them on Facebook, Google+, Linkedin etc.