Most people think of a web server as a magical black box that conjures pages out of thin air. It isn’t. At its core, the job is surprisingly mundane. A web server retrieves a file from a disk and shoves it down the wire to your browser. That’s it. Simple. Direct.
Let’s trace what happens when you type a URL into the address bar. Imagine you enter http://www.bygpub.com/books/tg2rw/author.htm. The server receives a request for the specific path /books/tg2rw/author.htm. If you could peek inside the server’s configuration, you’d see a root directory defined during setup, something like c:\My Documents\www. The server doesn’t look for /books/tg2rw/author.htm on the entire hard drive. It looks for that path relative to the root. So it combines the two: c:\My Documents\www + /books/tg2rw/author.htm. It finds the file. It sends it. Done.
But what happens when the URL ends in a slash? Like http://www.bygpub.com/books/tg2rw/?
The server understands this as a directory request, not a file request. It needs a default file to serve. It doesn’t guess randomly. It follows a strict hierarchy. It looks for index.html. If that’s missing, it tries index.htm. If that fails, it checks for default.html. Finally, it tries default.htm. The exact list depends on the server software, but the logic is consistent. The server silently converts the directory URL into a file URL, appending the first match it finds. So that directory request becomes http://www.bygpub.com/books/tg2rw/index.htm. You never see the filename change. You just see the page load. Every other file in that directory requires you to name it explicitly. This is the baseline for handling static files.
Beyond Static Files: The Role of CGI
Static files are only half the story. Most modern web servers handle dynamic files too. They don’t generate these pages on the fly from scratch; they hand off the request to an external program. This mechanism is called the Common Gateway Interface, or CGI.
You’ve used CGI countless times without realizing it. It’s the engine behind any web page that changes based on your input. Consider these examples:
-
Guest books : You enter a message in an HTML form. The server doesn’t just send a pre-written page. It runs a script that appends your text to a database or file, then generates a new page showing your entry.
-
WHOIS lookups : You type a domain name into a form. The page you get back depends entirely on the domain you entered. The server isn’t serving a static file; it’s asking a program to fetch live data.
-
Search engines : You type keywords. The server runs a query, scans indexes, and dynamically creates a results page tailored to your search.
All of these interactions rely on CGI. The web server acts as a dispatcher, passing the user’s form data to a program, then sending the program’s output back to your browser. This separation allows servers to handle complex logic without getting bogged down in the



























