Web Servers

ShaheerShaheer
4 min read

What is a Web Server?

A web server is a computer system that is capable of delivering web content to the requestor over the internet via web browser. To make this happen there is an involvement of two kinds of webserver.

1. Hardware Webserver

When we talk about the hardware webserver it includes the webserver software and the data files that are to be hosted, Some examples are HTML Files, CSS files, and JS files. This Hardware web server is connected to the internet and servers to all the devices connected to the internet.

2.Software Webserver

Coming to the Software Web server, it is installed on the Hardware Webserver to server the client's requests(end-user). This is basically an HTTP server. It is a piece of software for transferring files such as web pages from the Hardware webserver where all the files are hosted to the web browser on the client's system by understanding the URL's and serves according to the HTTP/HTTPS requests.

How does it work?

When the client (end-user) searches for any particular website the request is carried forward to the HTTP server (the software Web server) which is on the Hardware Webserver. The software fetches the files in the Storage space on the Physical Webserver and sends the Web content(response) to the client's web browser. All this communication is done through HTTP (hyper text Transfer Protocol ), a way to transfer hypertext the linked document between two computers.

Annotation 2022-12-09 164817.png

The Process consists of 4 steps :

  1. Obtaining the IP Address from the domain name: Clients web browser first obtains the IP address of the domain name (e.g. for this page domain name is https://hashnode.com). It obtains either by searching in its cache or by requesting one or more DNS(Domain Name System) servers.

  2. Getting Full URL: The browser gets the full URL from the Web Server by providing the IP address.

  3. Web Server responds with the request: The web browser responds to the browser by sending the desired web pages, and if the page does not exist then it sends an appropriate error code.

    some of the most common error codes you might have observes are Error 404,401 etc. Error 404 is displayed on the web browser when the page does not exist. Error 401 is displayed when the credentials are incorrect like username or password.

  4. Browser displays web page: In this step, browser gets the web page and displays it.

Why web servers are used?

Web Server perform various functions and we are going to discuss few major functions. One of them is the storage and protection of crucial data. A webserver can securely store and protect data from unauthorized users. It can set the bandwidth and manage the data transmission to minimize the the excess network traffic and eliminate downtime scenarios. To make the webpages dynamic the web server supports server-side web scripting, Languages such as Ruby, Python, and PHP are used to do so. Web servers are also used as virtual servers to run multiple applications, websites, data, and other services.

Static and Dynamic webservers

In the process of rendering web pages, the HTTP server upon receiving a request checks if the requested URL matches the existing files in the server. If the file is present then it sends the file to the web browser else server checks if it should generate a file dynamically for the request. if neither of the options possible then it sends the appropriate Error codes.

Now that we know where we are required to understand the dynamic webserver functionality, we shall discuss it.

Static Webserver

A server can behave as a static as well as a dynamic web server. A Static web server is a typical setup of a webserver where it consists of hardware or a computer with the HTTP server. These are called static because they send the hosted files as it is to your browser ( Static means "served as-is" ).

An example of a static webserver is Nginx webserver.

Dynamic Webserver

As said earlier the server behaves as both. So, the dynamic webservers includes a static server and additional softwares like application server and database. It updates the contents of the web page such as images, videos and HTML text from the application server or the storage server before sending them to the user's web browser. This approach is more flexible but it is hard to build a dynamic website with all the complex functionality.

Example of dynamic webserver is Apache HTTPS web server

dynamic.png

  1. Apache
  2. Tomcat
  3. NGINIX
  4. LiteSpeed
  5. CentOS Streams
1
Subscribe to my newsletter

Read articles from Shaheer directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shaheer
Shaheer