Basics of Backend Engineering

What is a Server?

Servers are the bedrock of backend engineering hence the name Server-Side Development. In the client-server architecture, when a client sends an HTTP request, as discussed above, an application somewhere on the side-side will receive this request, process it, and return a response to the client. This application or hardware is called a server.

What is a Server?

A server is an application or hardware that receives and processes requests transmitted over the network, providing appropriate responses. To break things down, the device that makes the request is called the Client, while the device that receives and processes the request is called the Server. This system of sending requests and receiving responses is called Client-Server Architecture.

What are they used for?

Servers are used for numerous things, and especially, they are used to manage network resources. As a Backend Engineer, you can set up a server to receive and send emails, respond to HTTP requests, manage print jobs, or host a website.

Also, many types of servers depend on what you want to achieve. Here is a list of some of the servers you can use.

  • Application server —> This is a dedicated server set up to serve a specific set of software. For instance, you may sign up for online gaming and be directed to servers set up solely for the gaming software.

  • Blade server: A blade server is a computing device for data management and distribution across interconnected computers and systems.

  • Cloud server: A cloud server is a server, either virtual or physical, that is hosted remotely by a cloud service provider, and customers can access it through an internet connection.

  • Database server: A database server is equipped with a database application, offering database services to other computer programs or computers.

  • Dedicated server —> A Dedicated Server is a physical server where all the computing resources are exclusively allocated to a single user.

  • File server —> The file servers manage, serve, and secure files. A client can send and receive a file as a response.

  • Mail server —> A mail server is set up for mail management to send, receive, and store emails. There are two primary types of mail servers: IMAP and POP3 Servers. IMAP is quickly becoming the most popular server, allowing you to read your mail on multiple devices.

  • Proxy server —> A proxy server mediates between server-to-filter user requests and a client program. So, it allows the management of emails and shared connections.

  • Web server —> A web server is specifically designed to store and deliver web pages to users who request them. As a crucial element of the Internet infrastructure, its primary purpose is to host websites and various web applications.

type of servers.png

What are Web Servers?

A web server is a software application that serves clients' web pages and other web content upon request. It is responsible for receiving HTTP requests from clients (typically web browsers) and responding with the requested resources, such as HTML pages, images, CSS files, JavaScript files, etc.

When a client requests a web server, the server processes the request, retrieves the necessary resources from the file system or a database, and sends the response back to the client. This response typically includes the requested resource along with an appropriate HTTP status code (indicating the success or failure of the request), headers (providing additional information about the response), and any optional content.

Web servers are the backbone of the World Wide Web and play a crucial role in delivering web content across the Internet. They handle the communication between clients and web applications, ensuring the proper delivery and rendering of web pages.

Examples of popular web servers include Apache HTTP Server, Nginx, and Microsoft IIS (Internet Information Services).

It's important to note that a web server can also support additional functionalities, such as handling server-side scripting, authentication, session management, caching, load balancing, and more, depending on the specific server configuration and web application requirements.

How do web servers work?

Web server software is accessed through a website’s domain and ensures the delivery of the site's content to the requesting user.

The software aspect of a web server consists of multiple components, including at least an HTTP server. The HTTP server is capable of interpreting HTTP requests and understanding URLs. Also, as hardware, the web server stores web server software and other website-related files such as HTML documents, images, and other programing language files.

How Web Server Works.png

When a web browser needs a file hosted on a web server, it will send a request to the web server specifying the file's location using HTTP. When the web server receives the request, the HTTP server will accept and process the request and, lastly, sends back a response to the web browser with the file or error (if not found) through the same HTTP connection.

To elaborate, when a browser makes a request for a page from a web server, the process involves a series of sequential steps:

First, a person will specify a web browser URL and send a request. The web browser will obtain the IP address of the domain name through DNS (Domain Name Service) or by checking its cache.

After obtaining the IP address, the browser will format the request into a proper HTTP request format understood by a web server, including all the headers and bodies, and lastly, it will send the request through HTTP.

The web server will process the request by validating and calling the appropriate web pages or API controllers in your remote computer to process the request and return an HTTP response to the web browser.

The web server will generate an error message if the requested page or endpoint does not exist or encounters an issue.

Lastly, the web browser will render and display the page or API data in JSON, XML, or GraphQL format.

Types of Web Servers

The types of web servers depend on the type of content and response they send back to the web server. If the content is dynamic, we categorize that web server as dynamic or static if otherwise.

  1. Static servers

  2. Dynamic servers

Static Servers

A static web server sends its hosted data as shown in your web browser. A static web server consists of a computer equipped with HTTP software. It is termed "static" because the server delivers hosted files to a browser exactly as they are, without any modification.

Dynamic Servers

A dynamic web server consists of a static web server plus extra software, most commonly an application server and a database. We call it “dynamic” because the application server updates the hosted files before sending them to your browser via the HTTP server.

The web server has the capability to generate content dynamically when requested from the database. Although this approach offers greater flexibility, its implementation is also more intricate.

Many web servers are available for different purposes created by companies such as Microsoft, Apache Software Foundation, or Sun Microsystems. Below are some of the common web servers:

  • Nginx. Nginx is a well-known open-source web server highly favored by administrators for its efficient resource usage and scalability. Its event-driven architecture enables it to handle numerous concurrent sessions adeptly. Additionally, Nginx is versatile, capable of functioning as a proxy server and load balancer.

  • Apache HTTP Server. This free and open-source web server is compatible with various operating systems, including Windows, Mac OS X, Unix, Linux, and Solaris. It is licensed under the Apache License, as the Apache Software Foundation developed it.

  • Microsoft Internet Information Services (IIS). It is a closed-source and private web server developed by Microsoft. It’s popular and widely used by Microsoft platforms and developers.

  • Sun Java System Web Server. Sun Microsystems offers a free web server that runs on Windows, Linux, and Unix systems. This web server is well-suited for managing medium to large websites efficiently.

  • Lighttpd. The FreeBSD operating system includes a free web server known for its speed, security, and low CPU power consumption.

I will explore one of the web servers in depth in this hub, but for now, let’s look at some web server security practices.

Web Server Security Practices

You can apply infinite best practices to your web server to make for a safer experience; most of these will depend on your use cases and what you want for your web server. However, below are a few examples of security practices that you can start with:

  • Incorporate a reverse proxy to conceal your internal server and function as an intermediary for incoming traffic from your internal server.

  • Implement access restrictions by employing rate limiting, restricting the web host's access to infrastructure machines, or utilizing a secure socket shell (SSH).

  • Continuously update and patch your web server to ensure it remains secure and protected against potential vulnerabilities.

  • Always monitor your network to make sure there isn’t any unauthorized activity.

  • Using a firewall and SSL as firewalls can monitor HTTP traffic while having a Secure Sockets Layer (SSL) can help keep data secure.

Next, I will explore one of the web servers to show you how to install, configure and use a web server which will aid you in building scalable backend systems.

Whenever you're ready

There are 4 ways we can help you become a great backend engineer:

The MB Platform

Join 1000+ backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learnings and set schedules, and solve backend engineering tasks, exercises, and challenges.

The MB Academy

The “MB Academy” is a 6-month intensive Advanced Backend Engineering BootCamp to produce great backend engineers.

Join Backend Weekly

If you like post like this, you will absolutely enjoy our exclusive weekly newsletter, Sharing exclusive backend engineering resources to help you become a great Backend Engineer.

Get Backend Jobs

Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board