Need cloud computing? Get started now

What Are Web Servers?

At a basic level, a web server stores and delivers websites and web applications. Web servers are composed of hardware and software that work together to facilitate the exchange of data.

The hardware component of a web server refers to the physical or virtual computer that stores the website’s files and components. This includes everything from static HTML documents, text files, images, and videos to more complex dynamic scripts. For example, if you visit a website with a video on its home page, that video is stored on the web server hardware.

The software component of a web server is responsible for controlling how users can access the files stored on the server. It does this by managing the requests that come in from web browsers and other devices connected to the internet. The software installed on the web server allows you to view websites in your web browser.

Let’s start by digging into the components that make web servers tick.

Hypertext Transfer Protocol (HTTP)

HTTP enables web servers to deliver websites and web applications to users, so they can access and view content on the internet.

When you use a web browser to access a website, your web browser sends a request to the web server hosting that website. This request is in the form of an HTTP message. The web server receives and processes the request, retrieving the requested resource from its hardware and software components.

In the image above, we can see that the web server sends a message to a web browser using HTTP. To request a website, we can simply type its URL into the browser’s address bar. The browser then maps this URL to an IP address, which represents the server’s physical location where the website is stored. If the server is found at this IP address, the web server software will receive the request and send back the website we asked for. So, if we typed “www.example.com” into the browser, the web server would return the website for “www.example.com.”

Self-hosting vs. hosting provider

When it comes to hosting your web application, you have a choice between using a hosting provider or setting up your own server on your home computer. Individuals often self-host, but for organizations that provide essential services, a hosting provider offers much more protection.

With a hosting provider, you can take advantage of high-speed servers and networks. A hosting provider also can reliably handle fluctuating power consumption and protect from potential failure. But the biggest reason that we use hosting providers for essential services is to ensure private information doesn’t leak into the public domain.

Web server software

Web server software is the heart of any website or web application. It enables us to serve web content to users over the internet. When we are setting up a website and configuring our servers, we need software to make it work.

In terms of software, two solutions dominate the market: Apache and NGINX. We’ll go over those two here, but it’s worth noting that there are other options, including IIS and Lighttpd, each with unique benefits and challenges.

Apache

Apache is a widely used web server software ideal for hosting dynamic content, such as ecommerce sites or forums. It can run on multiple platforms, including Windows, macOS, and Linux. It’s been around since about 1995 and is one of the oldest and most widely used web servers available.

Apache is capable of handling a variety of web protocols, including HTTP, HTTPS, and FTP, and can run on many different operating systems, including Windows, Linux, and macOS. It is highly customizable, with various modules that can add additional functionality, like support for dynamic content, authentication, and caching. It was specifically built to process dynamic content within the server itself, independent of any server components.

Apache has a one-connection-per-process model, which is a traditional approach to building web servers where each client connection is handled by a separate process, or thread. This thread is responsible for managing the client’s connection and processing their requests until the connection is closed. Because Apache uses this model, server performance is significantly degraded when the number of concurrent connection requests surpasses the number of processes.

One of the key features of Apache is its ability to support multiple virtual hosts on a single server, allowing websites to share resources while maintaining their unique configurations. Apache is also highly extensible, with a large community of developers creating and maintaining additional modules and plugins to extend its functionality.

NGINX

On the other hand, NGINX (pronounced engine X) is optimized for serving static content like images and videos, and is popular for its ability to handle large numbers of simultaneous client connections. NGINX is highly valued for its ability to improve content delivery over the web.

NGINX was built using an asynchronous, event-driven model. Let’s go over those concepts for a moment.

We use asynchronous models when a system needs to handle many simultaneous requests, such as in web servers, network communication, and database management. By using an asynchronous programming model, these systems can achieve better performance and scalability, and reduce the risk of blocking and freezing.

An event-driven model is driven by events in the system rather than following a predetermined sequence of steps.

So having an asynchronous and event-driven model allows a system to handle multiple tasks and events together without blocking the processing of other tasks.

Because of its architecture, NGINX cannot process dynamic content, such as PHP. It must pass it on to an external processor for execution. For this reason, NGINX is more suited for static content, reverse proxy, load balancing, mail proxy, and HTTP caching. NGINX is also recommended for Linux systems.

Using NGINX and Apache together

NGINX and Apache are often used together. By doing so, we can leverage each server’s strengths while overcoming its limitations.

One of the most common methods of integrating Apache and NGINX is by placing NGINX in front of Apache to handle all incoming HTTP requests, as seen in the above image. This configuration involves directing all incoming HTTP requests to NGINX, which then relays requests for dynamic content to Apache while serving requests for static content by itself

By placing NGINX in front of Apache, we take advantage of NGINX’s ability to handle large volumes of simultaneous connection requests with its asynchronous, event-driven model. This helps alleviate some of the strain on Apache by reducing the number of open threads and processes required to handle requests, which can otherwise degrade Apache’s performance.

The reverse proxy configuration also provides additional benefits, such as load balancing and improved security. NGINX can distribute requests across multiple Apache servers, balancing the load and preventing any single server from becoming overwhelmed. Additionally, NGINX can act as a buffer between the internet and the web server, providing an extra layer of protection against attacks.

Frequently Asked Questions (FAQ)

A web server refers to software or hardware that handles the delivery of web content (like web pages, images, and videos) to users over the internet. When someone visits a website, their browser sends a request to the web server, which then processes the request and sends back the requested web pages.

A web server is software or hardware that uses HTTP (Hypertext Transfer Protocol) to serve files that form web pages to users in response to requests from their browsers. A website, on the other hand, is a collection of those web pages accessed through the internet. So, the web server hosts and delivers the website content to users.

Why customers choose Akamai

Akamai is the cybersecurity and cloud computing company that powers and protects business online. Our market-leading security solutions, superior threat intelligence, and global operations team provide defense in depth to safeguard enterprise data and applications everywhere. Akamai’s full-stack cloud computing solutions deliver performance and affordability on the world’s most distributed platform. Global enterprises trust Akamai to provide the industry-leading reliability, scale, and expertise they need to grow their business with confidence.

Explore all Akamai security solutions