How a web server works:

Learn about web servers and how they work.  By FreeHostingTips

Web servers play a crucial role in storing and exchanging various types of information with other devices. In order for an exchange to work, there needs to be at least two participants i.e. the client, which requests the required information and the web server that stores the data. Both sides also need to use special software to negotiate this exchange of data. The client for example, would normally use a web browser like Firefox or Internet explorer. The server however, can use a high variety of different programs and software. Usually this depends on the type of Operating System, where the Microsoft Internet Information Server and the Apache Web Servers are the most popular choices.

Web servers can perform very different tasks and for the sake of this article we will focus on how servers are used in order to display information in the form of websites and the content displayed on web pages.

When you type in an address of a web page into the search field of your browser, several tasks and commands take place within a couple of seconds. In order for us to best explain the process, we have decided to brake it down into multiple steps outlined below. Here is a very simplified description of an exchange between the client and the web server:

how web server works

1. A person types in the URL of the internet website that he/she wants to visit. Let’s use http://www.freehostingtips.com/website-speed-test.php as an example.

2. The client browser then splits the URL to three separate parts: the protocol (in this example it’s “http”), the server address/server name (in this case it’s www.freehostingtips.com) and the part of the URL (i.e.the file name) which you requested for (in this case it’s “website-speed-test.php”).

3. The browser then contacts the DNS (Domain Name Server) to translate the entered domain name into its personal IP address. The DNS servers are basically very simple databases that work to connect domain names to IP addresses.

4. Once the address of the server is established, the browser then determines which protocol should be used for communication. In order to load a basic website, the HTTP protocol is used.

5. The next step for the browser is to send a special “GET” request to the web server in order to retrieve the address and the page it has been provided. Simply speaking, the browser requests the server to display the information contained at “website-speed-test.php”. Unless there are any special security protocols implemented, the server now responds to the request from the browser. It will verify the integrity of the address, lookup the necessary files, run the appropriate scripts and finally returns the results to the browser.

6. The browser will translate all the data into the HTML format and render the result to the user on his/her screen. If there are several types of files needed to show a web page (for example images or media files) then the web browser needs to make additional requests in order to obtain each of these.

7. The page http://www.freehostingtips.com/website-speed-test.php will eventually appear in your browser window in the form of text, images and scripts. The whole process usually takes seconds to complete.

As we mentioned in the listed points above, the HTTP (HyperText Transfer Protocol) was used for communication with the server. This protocol tells us basically two things: 1. which port the communications will take place on (HTTP normally used port 80) and 2. What will be the actual format of the communications (in the example above, the command GET is understood by the HTTP protocol).

The IP (Internet Protocol) address mentioned in point 3 is basically a 32-bit numeric address usually expressed as four numbers that are separated by periods. Here is our IP for example: 74.220.215.228. Each of the four numbers in the IP address are called octets since they can have values from 0 to 225. Every machine (device) on the Internet will have it’s own unique IP that is used to communicate with others.

This was a very simple explanation as to how web servers are used to display information from different website on the Internet. What might look very straightforward for us, usually involves a whole set of complex interactions which are necessary in order to communicate information across one machine to another. If you want to see how fast your web server works then feel free to check out our free website speed test tool.