Web Server

January 30, 2019

Web server is a type of program that uses Hyper text transfer protocol shortly termed as  HTTP to serve the files that form the web pages to the users as a response for their request, which are forwarded by their computer’s HTTP clients.

A web server comes as a part of a larger packet of intranet and internet related programs for serving Email facility, building or publishing web pages and downloading request for File transfer protocol (FTP) files. Choosing a suitable Web server depends on how well it works with the operating systems and other servers, its capability to handle server-side programming, security characteristics with particular publishing.

Talking about the most basic level, whenever a browser requires a file which is hosted on a web server, browser requests for a file via hyper text transfer protocol. On reaching an exactly correct web server, HTTP server accepts the request, in case of not finding the requested document the same sends it back to the browser through HTTP.

About Static and Dynamic

A static server consists of a computer with an HTTP server i.e. software. The name static is so because the server sends its hosted files as it as to your browser.

On the other hand, a dynamic web server consists of a static web server in addition to extra software which is nothing more than an application server and a database. We call it dynamic because application server updates or change the hosted file before sending it to the browser through (Hyper Text Transfer Protocol) server.

Sites such as MDN or Wikipedia contain a large number of web pages but they are only a few HTML templates with a giant database instead of real HTML documents. Hence, this setup helps in making the setup easier and quicker for maintaining and delivering the content.

Static vs Dynamic

Static websites are easiest to set up but on the other hand, dynamic provides more flexibility but as far as the technical stack is concerned it becomes more difficult to handle, shaping it dramatically more complex to build the website.

Let us take an example of a page that one is reading right now. The web server hosting it, there is an application server that allows article content from the database, formats it and put the same inside some HTML templates.

Hosting files

To fetch a web page, we need to go through a process of finding or processing a file etc. Let us have a look at all those steps in detail:

A web server firstly needs to store the website’s files, basically all the HTML documents and their related assets with quality images, CSS stylesheets, fonts, videos, and JavaScript.

Technically, one can host all the files on the computer but the more a convenient way to store all of them on a dedicated web server that includes such properties and features which are as follows:

  • Always up and running
  • Always connected to the internet
  • Contains the same IP address all the time
  • Maintained by the third-party provider

For all these above reasons, so a key part to building a website it is more than important to find the best hosting provider. Among the various services companies offer to choose the one that fits your needs as well as the budget (as it may range from free to thousands of dollars per month).

Communicating through HTTP

A web server provides support for Hyper Text Transfer Protocol. As its name itself implies, HTTP specifies the way to transfer hypertext between two computers where hypertext is nothing than a linked web document.

Hyper Text Transfer protocol provides clear rules which show how a client and server communicate. Let us have some points which signify more about such rules:

  • Only clients can make HTTP requests, and servers can only respond to a client’s HTTP requests.
  • A client must provide a URL while requesting a file via HTTP.
  • The web server must need to answer the every HTTP requests with an error message.

HTTP server is the responsible one for processing and answering the incoming requests on a web server.

  • On receiving a request, hyper text transfer protocol server first checks whether the requested URL matches to the existing file or not.
  • If URL matches the existing file, the web server sends the file content back to the browser and builds the necessary file.
  • In case, if nothing doesn’t work, the web server returns an error message to the browser and commonly shows the message of 404 not found.

There are lot many application servers and it’s not an easy task to choose the best one amongst all. Some application server caters to specific website types and categories such as blogs, wikis, e-shops or CMSs (content management systems). If you are seeking to build a dynamic website, give extra time to select the best tool that fits your needs. Unless one does not wants to learn about server programming, no one can be able to build their own application server.