Static Sites & Deployment

Web Server

Definition

A web server is a program that holds a socket open on a port — 80 for HTTP, 443 for HTTPS — waits for requests and returns responses. Serving a static site is mostly lookup: take the path from the request line, map it onto a file under a document root, read that file, set a Content-Type header from its extension and send it with a status of 200. Nginx, Apache httpd, Caddy and Microsoft IIS are the widely used ones, alongside the small development servers built into Node and Python. The word names the software and not the hardware — one machine can run several web servers on different ports, and one web server can serve hundreds of sites by matching the Host header on each request. Serving a file and building a page from a database are separate jobs, even when the same process happens to do both.

Why It Matters

Almost every odd behaviour on a freshly published site comes from a web server decision, not from the HTML. Whether /about resolves to /about/index.html, whether a missing file returns your designed 404 page or a grey default, whether a font is sent as font/woff2 or as an unknown type the browser refuses — all of that is server configuration. Get the type wrong on a JavaScript bundle and a modern browser refuses to execute it, so a page that looks fine locally is blank once published. Running your own means you also own TLS renewal, security patches and the day traffic multiplies by fifty; a hosted platform trades that control for never touching a config file. Behind a CDN the same software is described as an origin server, which is a change of role rather than of program.

How It Works

A browser opens a connection, completes the TLS handshake if the scheme is HTTPS, and sends a request line with a method and a path, followed by headers including Host. The server picks the matching virtual host, joins the path onto that host's document root, and checks what is there. If the path names a directory it looks for a default document, normally index.html, and either serves it or returns a directory listing or a 403 depending on configuration. It then writes a status line, a Content-Type, a Content-Length and usually a Cache-Control header, and streams the bytes back, holding the connection open for the next request. Anything not found produces a 404, and anything the server itself failed at produces a 5xx, which is the line that matters when you are working out whose fault an outage is.

Real-World Example

A studio publishes a twelve-file marketing site on 99helpers and it answers at harlow-launch.99helpers.site seconds later. Nobody installed Nginx, edited a config file or opened a port — the platform runs the web server, resolves /pricing to the pricing folder's index.html, sets types from the file extensions and terminates TLS on the certificate it issued. The only thing the studio had to get right was the folder structure inside the upload. If the pricing page had been saved as Pricing.HTML, the link from the nav would have returned a 404, because the server matches paths exactly.

Common Mistakes

  • Assuming a page works because it opened from the desktop — a file opened directly has no server, so paths, types and redirects all behave differently
  • Letting the server guess types — a bundle sent as text/plain is refused by the browser and the page silently does nothing
  • Leaving directory listings switched on — anything in the folder becomes browsable, including the backup nobody meant to upload
  • Running a development server in production — those are built for one developer on a laptop and fall over under real concurrency

Related Terms

Put a file online in seconds

Drop in a document, an image, a page or a whole static website and share the link — free, with no build step and no server to set up.

Host a file free →