Getting started

What is a web server and how does it work?

What a web server is, how it handles an HTTP request from start to finish, static vs dynamic content, virtual hosts, ports and TLS, and the popular web server programs.

BeginnerEveryone3 min read

A web server is software that receives requests from browsers over HTTP or HTTPS and sends back web pages, images and other files. It is the part of hosting that actually delivers your website. This guide explains what a web server is and follows one request from start to finish.

Before you start

No setup is needed – this is a concept guide. If you want to see where DNS fits first, read how DNS resolution works.

What a web server does

  • Listens on network ports – 80 for HTTP, 443 for HTTPS.
  • Decrypts HTTPS traffic using your SSL/TLS certificate.
  • Works out which website the request is for (virtual hosts).
  • Returns a static file directly, or hands the request to an application (PHP, Node.js, Python) and returns its output.
  • Applies rules such as redirects, rewrites, compression, caching headers and access control.
  • Writes access and error logs.

One request, step by step

  1. The browser resolves example.com to an IP address through DNS.
  2. It connects to port 443 and performs a TLS handshake; the server presents the certificate for example.com (chosen via SNI).
  3. The browser sends GET /about HTTP/2 with a Host: example.com header.
  4. The web server matches the host to a virtual host and applies rewrite rules (for example from .htaccess).
  5. If /about maps to a file, it sends it. If it is handled by WordPress, it passes the request to PHP, which queries the database and builds HTML.
  6. The server sends the response with a status code (200, 301, 404, 500…) and headers, possibly compressed with gzip or Brotli.
  7. The browser parses the HTML and requests CSS, JavaScript and images – often over the same connection.

Static vs dynamic content

StaticDynamic
ExamplesImages, CSS, JS, plain HTMLWordPress pages, shop carts, dashboards
Work per requestRead a file and send itRun code, query the database, build output
SpeedVery fastSlower; benefits greatly from caching

Page caches such as LSCache turn dynamic pages into near-static responses, which is why they make such a big difference.

Virtual hosts: many sites, one server

Thanks to the Host header and SNI, one web server and one IP address can serve hundreds of domains. Each virtual host has its own document root, logs and certificate. This is how shared hosting works.

  • Apache – flexible, module-based, supports .htaccess.
  • Nginx – event-driven, popular as a reverse proxy.
  • LiteSpeed – event-driven, Apache-compatible, with LSCache; used on MdmHost hosting.
  • OpenLiteSpeed – free edition of LiteSpeed.
  • Caddy – automatic HTTPS and simple config.
  • Microsoft IIS – for Windows Server and ASP.NET.

Common HTTP status codes

  • 200 OK – success.
  • 301/302 – redirect.
  • 403 – forbidden (permissions or rules).
  • 404 – not found.
  • 500 – application error.
  • 502/503/504 – a backend or upstream problem, overload or timeout.

FAQ: what is a web server?

Is a web server hardware or software?

Both terms are used. Strictly it is the software (such as LiteSpeed); people also call the machine running it a web server.

Do I need to install a web server on shared hosting?

No. The host runs and maintains it; you upload your files.

Can one server run two web servers?

Yes, but only one can use ports 80/443 directly. A common setup puts one in front as a reverse proxy for the other.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.