Blog / What is a web server?

What is a web server?

by SW Team

A web server is a computer programme installed on the server and designed to receive, process and respond to requests for web resources from clients, such as web browsers. It functions as an intermediary between the client and the server that hosts the web resources (files, images, code), facilitating the delivery of content to users accessing the internet.

cta:cloud_app_swpanel_smart_d5

How does a web server work?

To see a web server in operation, it is necessary to have a client that makes a request via HTTP/HTTPS. On a daily basis we use web clients, also called browsers, such as Chrome, Firefox or Safari. When we search for the domain of a website in the browser, a series of requests are made to various servers before we get the website we are looking for.

- 1. DNS resolution: First, as we explained in the blog "What is a domain?", we need to translate the domain name to the IP of the server where the website is located.

- 2. Request to the web server: Once the IP address of the server is available, your browser sends a request to the corresponding server asking for the specific web page you want to see.

- 3. Processing the request: Once the web server receives the request, it begins to process it. This involves determining what specific resource is being requested, such as an HTML page, an image, a CSS or JavaScript file, among others. To do this, the web server can interpret the URL and other data in the request to determine which file or resource it should serve.

  • a. Access to static resources: If the request involves access to static resources, such as HTML, images, CSS or JavaScript files, the web server retrieves them directly from the directory where they are located.

  • b. Code interpretation (in case of dynamic applications): If the request involves code execution, as in the case of dynamic web applications using technologies such as PHP, Python, Ruby, Node.js, among others, the web server can pass the request to a corresponding code interpreter. This interpreter will execute the code, generate the dynamic content and return the results to the web server for delivery to the client.

- 4. Response generation: Once the web server knows what resources it needs to satisfy your browser's request, it generates the response that will be sent back to the browser with those resources. This response may include the requested content, as well as HTTP headers that provide additional information about the response, such as the type of content, the status code (such as 200 for success, 404 for resource not found, etc.), among others.

- 5. Sending the response to the browser: Finally, the web server sends the response to the browser that made the request. The browser receives this response and interprets the data received.

- 6. Rendering the content: Once the browser has received the HTML content, along with other resources such as CSS and JavaScript, it begins to render the web page. This involves interpreting and processing the HTML to build the DOM (Document Object Model) tree, applying CSS styles to format and layout the page, and executing JavaScript scripts to add interactivity and functionality to the page.

- 7. Viewing the web page: Finally, the browser displays the fully rendered web page in the user's window, allowing the user to interact with the content and navigate the website as needed.

cta:cloud_app_swpanel_smart_d5

Types of web servers

Nowadays, there are multiple softwares to implement web servers. Depending on the operating system of the server and the needs that we have to cover, we will have to choose between one or another: Apache HTTP Server: This is one of the oldest and most widely used web servers. It is known for its stability, flexibility and support for a wide range of modules and configurations. It is open source and runs on most operating systems, making it very versatile.

Nginx: Is known for its high performance and efficiency in handling large numbers of simultaneous requests. It is designed to be lightweight and scalable, being especially useful for serving static content and acting as a reverse proxy for application servers. It is widely used in high-load environments and large-scale websites.

Microsoft Internet Information Services (IIS): Developed by Microsoft, it is the most commonly used web server in environments running the Windows Server operating system. It offers tight integration with other Microsoft technologies, such as ASP.NET and Microsoft Web Services, making it popular with organisations using Microsoft solutions in their infrastructure.

LiteSpeed Web Server: Similar in functionality to Apache, but with a focus on performance and efficiency. LiteSpeed is known for its speed and ability to handle heavy workloads. It offers features such as PHP acceleration and page cache support, making it ideal for improving the performance of dynamic and high traffic websites.

At SW Hosting we use Apache and Nginx together, which gives us all the advantages of both software, making a high performance, efficient, stable and flexible Web Server.

cta:cloud_app_swpanel_smart_d5

i