When discussing how a Web server works, it is not enough to simply outline a diagram of how low-level network packets go in and out of a Web server. To give such a nuts-and-bolts explanation some sort of practical value, it must be placed in context. Thus, this tutorial will discuss what a Web server does to enable a better understanding of how it does its work.
When discussing how a Web server works, it is not enough to simply outline a diagram of how low-level network packets go in and out of a Web server.
Years ago, when Web servers were first prototyped, they served simple HTML documents and images. Today, as we shall go into later in this tutorial, they are frequently used for much more.
The first step is to view the Web server as a black box and ask the questions: How does it work; What can it achieve? It’s a safe assumption that most Internet users believe a Web site’s success or failure is due to its content and functionality rather than the server used to power it. However, the choice of the correct server, and understanding its capabilities and limitations is an important step on the road to success.
So what does a Web server do? As we mentioned earlier, it serves static content to a Web browser at a basic level. This means that the Web server receives a request for a Web page such as
and maps that Uniform Resource Locator (URL)to a local file on the host server.
In this case, the file
is somewhere on the host file system. The server then loads this file from disk and serves it out across the network to the user’s Web browser. This entire exchange is mediated by the browser and server talking to each other using Hypertext Transfer Protocol (HTTP). This workflow is shown in the figure below.
That’s all there is to it.
But if it’s that simple, then why such an in-depth tutorial?
Because this simple arrangement, which allows the serving of static content such as HyperText Markup Language (HTML)and image files to a Web browser was the initial concept behind what we now call the World Wide Web. The beauty of its simplicity is that it has led to much more complex information exchanges being possible between browsers and Web servers.
Perhaps the most important expansion on this was the concept of dynamic content (i.e., Web pages created in response to a user’s input, whether directly or indirectly). The oldest and most used standard for doing this is Common Gateway Interface (CGI). This is a pretty meaningless name, but it basically defines how a Web server should run programs locally and transmit their output through the Web server to the user’s Web browser that is requesting the dynamic content.
For all intents and purposes the user’s Web browser never really has to know that the content is dynamic because CGI is basically a Web server extension protocol. The figure below shows what happens when a browser requests a page dynamically generated from a CGI program.
The second important advance, and the one that makes e-commerce possible, was the introduction of HyperText Transmission Protocol, Secure (HTTPS). This protocol allows secure communication to go on between the browser and Web server.
In a nutshell, this means that it is safe for user and server to transmit sensitive data to each another across what might be considered an insecure network. What happens when the data arrives at either end is another matter, however, and should not be ignored. We will discuss this a bit later.
In other words, explaining how a Web server works involves discussing more than just how a Web server serves documents. We will go over the following topics in our quest to finding out what and how a modernWeb server goes about doing its activities.
- What Is HTTP, and How Does It Work?
- How Does a Web Server Serve Content?
- How Does a Web Server Accept Connections?
- How Do You Choose a Web Server Platform?
- How Do You Organize Web Servers for Performance?
- How Do You Configure Web Servers for Performance?
- How Does Web Server Security Work?
- How Does a Web Server Differ From an Application Server?
- How Does a Web Server Run Web Applications?
We will start by explaining the low-level details the underlie what a Web server must do. Then, we will discuss the issues surrounding the use of a Web server and how it fits within the scope of other infrastructural elements of the Internet. We will then close with a discussion of the relationship that applications have with Web servers.