Brett Allred

be a student, not a follower

Web Server Basics

The job of a web server is to accept http requests and serve up http responses  (see http request response basics).  There are number of different web servers out in the world but the basic concepts are the same among them all.

When a request comes in to the web server, the Host header is examined and the request gets routed to the correct internal server.  Host based routing is what allows a single web server to host multiple websites.

When the internal server responsible for the website receives a request it has to make a choice.  First, it needs to see if the request is for a static file that exists on the web servers hard drive.  This could be an html file, javascript file, image, movie, etc.  If the static file exists it will return file to the client.

If no file exists, the web server can be configured to forward the request to another application for request processing.  If you are building a web application then the request gets forwarded to your application.  Your application can then examine the request and decide how to handle it.  This could involve saving items to a database, communicating with 3rd party web services, or rendering dynamic html views.

Web application frameworks have been built to make the process of handling request easier and creating custom web applications easier.