Kelly Mears

Web Server

The program that listens for HTTP requests and answers them with files or generated pages, from the first one at CERN in 1990 through Apache's long dominance to event-driven servers built to hold many thousands of connections at once.

Web Platform3 min read429 words9 out · 10 in
also calledHTTP serverApache HTTP ServerNginxVirtual hosting

A web server is a program that waits for requests from browsers and other clients, then answers them. A request names a path; the server responds with a file from disk, a page generated by a program, or an error code. The same name often refers to the machine running it, but the software is what defines the role.

The first was written by Tim Berners-Lee at CERN in 1990, alongside the first browser. The NCSA server at the University of Illinois became the most popular in the early web, and it introduced a way to run external programs to build pages on demand. When its development stalled, a group of administrators pooled their fixes into a new release in 1995. That became the Apache HTTP Server, which ran most of the world's websites for over a decade and grew a foundation around it. Paired with Linux, a database and a scripting language, it formed a standard stack for cheap dynamic sites; see LAMP stack.

A server has to tell clients what kind of content it's sending, so it labels each response with a type such as an image or a page; see MIME Type. Virtual hosting lets one server and one address serve many sites. Browsers send the site name with every request, and the server picks which site to answer for, which is how a single cheap machine can host thousands of domains.

How a server handles many visitors at once has shaped its design. Apache's classic model gave each connection its own Process or thread, simple and robust but memory-hungry, since thousands of idle connections meant thousands of idle workers; see Thread Pool. In 1999 an engineer framed this as the challenge of handling ten thousand simultaneous clients on one machine. Nginx, released publicly in 2004, answered with an event-driven design: a few workers each juggle thousands of connections, reacting whenever one is ready; see Event Loop. By several surveys it later overtook Apache as the most widely used server. Node.js later brought the same approach to application code.

Modern deployments often stack servers. A front server terminates encryption, serves static files and caches, and passes everything else to application servers behind it; see Reverse Proxy. Encryption used to require buying certificates and installing them by hand; free automated certificates, available since 2015, made HTTPS the default; see Let's Encrypt.

A server also keeps records. Access logs listing every request, its status and its size, in a format dating back to the NCSA server, were the web's first analytics, and remain essential for debugging and security.

See also2

Linked from10