How webserver serves the pages?

How webserver serves the pages?

To know how webserver serves the pages, there need to be some background knowledge of a few things.

First of all, the thing that should be in your mind that the browser can only understand HTML, CSS and Javascript.

HTML: It stands for Hyper Text Markup Language. It is a markup tags oriented language. It describes the web documents/pages. Each tag describes different document content. E.g. "<p>" is used for describing paragraph.

CSS: It stands for Cascading Style Sheets. If you want any HTML element to be displayed in a specific style or the layouts of web pages, is defined here in CSS.

Javascript: It is a language used to change/add behaviors to the web pages.

So, now we have the know how of the HTML, CSS and Javascript, then we can go explaining the details of webserver working.

Its working is explained in different steps, the steps will be explained according to the above image, so that it could be understood easily.

  1. When you type any URL in the browser and hit enter. The request goes to that server (webdevelopertuts server as per image). I am not going into the details of how it goes to that specific server. If you want to know, how the request goes to that specific server or how DNS is resolved then read the article How Domain is translated/resolved into IP Address?.
  2. The server goes into the specific directory/folder where sites are maintained and find the specific site's folder. In this case dailywebsolutions.
  3. It finds for the specific file requested by the user. When it finds the file,
  4. It gets the contents of that page (in other words it gets HTML, CSS and Javascript from that page because browsers only understand these things).
  5. Then it sends the content back to the user's computer from where the request was initiated. The computer's browser translates and show the content as defined in the code.
  6. Don't confuse yourself with the other tags like <html>,<head> etc. Every tag has different purpose.