Abyss Web Server For Linux User's Guide
Prev | Chapter 1. Introduction | Next

# How do web servers work?

What happens when you enter in the address field of your browser the URL `http://www.aprelium.com/doc/sample.html`?

First, the browser slices the URL in 3 parts:

- `http://`: This part indicates that the document you want to access can be retrieved from web server, which understands the HTTP protocol. The HTTP protocol is a standardized language of communication between browsers and web servers.

- `www.aprelium.com`: This is the host name of the computer from which the document can be downloaded.

- `/doc/sample.html`: This is the virtual path of the document in the `www.aprelium.com`'s web server.

Then, the browser contacts a DNS (Domain Name Server) to know the IP address of the computer which full qualified domain name is `www.aprelium.com`. The domain name server is usually run by your ISP or by your company.

The browser establishes a connection channel with the web server on the computer which IP address was given by the DNS server and requests the document on the host which name is `www.aprelium.com` and which virtual path is `doc/sample.html`. The browser has to specify in the request the host name because many modern web servers (including Abyss Web Server) have the ability to serve more than a one host from a single computer with a single IP address only. This is called virtual hosting. In such a case, the IP address of this computer is associated with more than one domain name.

The server decodes the request and maps the virtual path to a real one, which should match an existing file. The server sends the file to the browser with some useful information such as its last modification time and its MIME type. The MIME type helps the browser decide how to display the received document. In our example, it is a HTML file. So the server sets its MIME type to `text/html` and the browser understands that it must render it as text.

Sometimes you enter a URL without an explicit filename such as `http://www.aprelium.com/doc`. The browser sends the request to the web server as in the previous example. The server detects that the virtual path maps to a directory and not to a file. It searches then in this directory an index file. Index files are usually named `index.html` or `index.htm`. If it finds for example `index.html`, it acts as if the requested URL was `http://www.aprelium.com/doc/index.html`. If no index file is found, the web server generates a listing of the directory contents and sends it to the browser or reports an error.

Prev | Home | Next
Introduction | Up | Getting Started

Copyright © 2001-2013 Aprelium