Code

What is a Web Server and How Does it Work?

April 19, 2020
web-server-what-how-work

What is a web server? This is like asking “how does the internet work?” In this post, we will try to understand web servers: what exactly are they and how do they fit in this whole internet stuff? I’m going to explore this subject by answering What, Who, Where, Why and How.

What is a web server? It is both a hardware and a software that does exactly as its name implies, provides service through the web. It stores files (images, videos, html/css/js files, etc.), performs operations and sends files and responses to users upon requests. If you go to Youtube right now and search for cat videos, you are in essence being serviced upon. Youtube has loads of videos on its server and sends them to your device, according to what you search for.

Every website on the internet is hosted on a server which means, web servers are constantly (24/7):

  • Up and running (powered on)
  • Connected to the internet

A web server is a hardware, like your computer. But, it’s a much bigger computer and not necessarily just in terms of size, but in terms of capacity, storage, performance, etc. It is built specifically for serving web pages. A web server is also a software that makes it possible for multiple users from different locations to simultaneously access it.

Who uses a web server?

  • Internet users (browsing, watching YouTube, etc.)
  • Developers (building websites and web applications for any purpose)

Where are web servers located? The short answer is, the cloud. Long answer is, it doesn’t matter geographically because web servers only have to be connected to the internet to be reachable from any part of the world. You can buy a web server now, place it in your bedroom, connect it to the internet, and set it up to respond with “Hello, world!” whenever it is accessed and ¡voalá! You have your very own web server and no one has to know where it is as long as it works, right?

Why do we need web servers? If you’ve reached this far, you’d be able to answer this on your own. Without a web server, as a matter of fact, there would be no web, or the internet as we know it.

Finally, how do web servers work? Here’s an illustration at the most basic level. A web server responds to user requests or queries. Basically, whatever you do with the internet (Google search, youtube search, upload on Instagram, view your Facebook notification, etc.) performs a request to a web server. And like we’ve already established, the web server’s main job is to give a response to whatever request it gets. It doesn’t always give you what you need, but gives you a response nonetheless.

understanding web servers and how they work
understanding web servers and how they work

We can break it down into simple steps, for clarity (don’t worry if you don’t understand the terms, it’s the concept that matters for now):

  1. You perform a Google search (“dog”) let’s call this your request data
  2. Your request data is sent over through the web (internet) if you are online
  3. Your internet provider routes this request data throughout the internet until it finds the server where this data is addressed to
  4. Your request data reaches the Google web server
  5. Google server processes a response to your request (i.e. “dog” search results) let’s call this response data
  6. Google server sends this response data back through the internet, addressed to you
  7. You receive the server’s response data as search results displayed on your browser if you are online

That’s basically it. There’s nothing complex about it really. At the very least, it’s just a form of communication between non-living things. But it’s a very powerful concept, if you think about it. This is how the internet runs the world! If you want to get into the nitty gritty details, check out Mozilla’s wiki. If not, check out some of my tricks.

You Might Also Like

Share your thoughts

avatar
  Subscribe  
Notify of