Web servers are software or hardware (or both together) that stores and delivers content to a web browser at a basic level. The servers communicate with browsers using Hypertext Transfer Protocol (HTTP). Web servers can also support SMTP (Simple Mail Transfer Protocol) and FTP (File Transfer Protocol).
Web servers are also used for hosting websites and data for web applications. They can host single websites and multiple websites using virtualization.
Why is it important to understand the answer to the question, how does a web server work? The success of a website doesn’t just depend on its content and functionality but also the efficiency of the web server used to power it. This requires an understanding of a web server’s capabilities and limitations. 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.
How Does a Web Server Work Internally?
When the web server receives a request for content 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 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 involve 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 modern Web server goes about doing its activities.
We will start by explaining the low-level details underlying 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.
- 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?