How does a web server work

Simply put: what is a web server?

So that a website can be reached on the Internet, you need a special server for their content. In order for it to be continuously available, the server in question must be permanently online. While most website operators use the data centers of Internet providers for this, large companies and organizations often have their own web servers on which you host your intranet and Internet content. In this post you will learn how a web server works, what different solutions there are and what you should definitely pay attention to with regard to security.


What are the tasks of a web server?

A web server is primarily responsible for the reliable delivery of static and dynamic content to the requesting clients.

Can a web server be implemented on any platform?

Yes, but the server software used must be compatible with the host's operating system.

Can I also build a web server myself?

For example, you can convert the Raspberry Pi single-board computer based on nginx into a web server. We'll explain how this works in the last section of this post.

1. What is a web server?

A web server is a web service that provides the components of a website. The term is often used as a synonym for the actual host.

By definition, the term “web server” denotes two very different things: On the one hand, it is A web service is meant that provides the components and information of a website and transmits it to a client via a web browser (e.g. Firefox or Chrome). In this case, the web server is software that is operated on a suitably equipped computer or a hosting product.

The term is often used as a synonym for the actual hardware (the so-called "host"). This is wrong because, depending on the software installed, it can also be used as a file server, FTP server or completely different purposes.

A web server can be used both locally and in company networks, which means that the relevant content is available both locally and worldwide, depending on the intended use. On the Internet, however, it is mainly used as a WWW service. Each web server is also able to deliver the content to several different computers at the same time.

2. How does a web server work?

The web server works as a "mediator" between the content of a website and the client that calls it up. Enter an Internet address (e.g. in your browser, then this sends a request to the name server, which in turn determines the associated IP address from the domain name.

The browser's HTTP client then establishes a connection to the web server via TCP (or occasionally also via UDP) and sends a website request to it. Since complete Internet pages consist of various HTML components, graphics, photos and videos, a separate request must be made for each filewhich the web server replies by transmitting the relevant content. To do this, the HTTP server sends the requested files to the HTTP client, which uses an interpreter to display them on the screen. Once the client has received the complete website, the TCP connection is closed again.

Good to know: Web servers are able to deliver website content to many different computers or browsers in parallel. How many user requests can be processed in what time depends, among other things, on the hardware used and the load on the host.

The returned HTML page can either be stored statically on the web server or generated dynamically on request. This means that the web server must execute the appropriate program code (e.g. Java, Python or PHP) before the response. Dynamic websites generally use more resources than static content.

3. Different solutions in comparison

Experts who have the appropriate technical know-how usually configure their servers themselves and work with different technologies. The prerequisite is, of course, that the The server software used is compatible with the host's operating system. If you do not want to deal with the configuration in detail, you can alternatively rent a preconfigured web server from a provider on the Internet.

Alternatively, you can rent preconfigured web servers from providers such as Strato or 1und1 IONOS.

Most web server programs are based on Unix or Linux, but can also be operated under Windows. The only exception is Microsoft IIS, which runs exclusively on Windows servers. The best known providers of web server software are:

  • Apache HTTP server (Open source, cross-platform use)
  • Apache Tomcat (Open source, can be integrated into other web servers e.g. Apache HTTP server or IIS)
  • Microsoft IIS (can only be used on Windows servers)
  • nginx (free of charge, can also be used as a reverse proxy)
  • LiteSpeed ​​Web Server (for Linux and Unix, available as open source or enterprise version)

Web server administration is usually carried out remotely from another computer. This does not necessarily have to be equipped with the same operating system as the server itself. It works most comfortably with remote maintenance software, one of the best-known representatives of which is Plesk from Obsidian. This means that a web server can be managed from a Windows as well as from a Linux or Unix computer.

4. Web servers and security

If you operate a server, you also have to worry about security, because the same dangers exist for it on the Internet as for a "normal" PC. In addition to choosing a secure operating system, there are a number of other basic measuresthat you should definitely take:

  • Keep your web server up to date and always install the latest updates. Outdated servers offer attack surfaces for hackers and cyber criminals who, in the worst case, can gain control of the entire system. With shared and managed hosting, this task is usually carried out by the provider concerned.
  • Install the minimum version of the operating system and only software that you really need. Stop unnecessary services and close all unused ports if possible.
  • Just forgive minimal rights for users and applications.
  • Choose if possible secure passwords and activate the firewall.
  • Install an SSL certificate. This is a digital data record that binds a cryptographic key to the details of an organization and confirms the authenticity of people and objects (e.g. when logging in).
  • Check periodically that Changes to programs or services were made.
  • Save and continuously review the log and log files.
  • Make regular backupsin order to be able to completely restore the system in the event of a failure.

5. The Raspberry Pi as a web server

5.1. Set up nginx

If you have a Raspberry Pi, you can use it to build a web server yourself. There are various possible solutions or web server programs for this, for reasons of stability, however, we choose nginx in this example. Proceed as follows for the installation:

  1. Be the first to update your Raspberry Pi. To do this, run the following commands:
sudo apt-get update

sudo apt-get upgrade
  1. Then install the web server package above
sudo apt-get install nginx
  1. Start the server about the command
sudo /etc/init.d/nginx start
  1. You can now go to the test page generated by nginx. To do this, open the browser of your Raspberry Pi and enter
http: // localhost /


Tip: To access the test page from another computer in the network, enter the address http: // IP-Adresse-des-Raspberry / in the browser. You can determine the IP address of your Raspi via the console using the command "hostname -l".

5.2. Install PHP

So that your web server is also able to provide dynamic websites, you need to install PHP in the next step:

  1. Install the PHP package about the command
sudo apt-get install php5-fpm
  1. Now activate PHP in nginx. To do this, switch to the nginx directory and open the configuration page in the NANO editor:
cd / etc / nginx

sudo nano sites-enabled / default
  1. Replace in the document
index index.html index.htm


index index.php index.html index.htm
  1. Find the entry further down the file
# pass the PHP scripts to FastCGI server listening on

and remove the diamond from the following six lines:

location ~ \ .php $ {

fastcgi_split_path_info ^ (. + \. php) (/.+) $;

fastcgi_pass unix: /var/run/php5-fpm.sock;

fastcgi_index index.php;

include fastcgi_params;

  1. Save the configuration and restart nginx:
sudo /etc/init.d/nginx reload
  1. Navigate to the folder with the default webpage by going into the console
cd / usr / share / nginx / www /

enter and replace the existing "index.html" with "index.php". You can then fill the latter with the content you want.

61 ratings

Ø 4.05
Simply explained: what is a web server?
4.05561Loading ...