How does the web work?

The backbone of the web is the network of webservers across the world. These are really just computers that have a particular type of software running on them - software that knows how to speak the HTTP protocol and knows which information stored on the computer should be made accessible through the web.

It's possible to turn almost any computer into a webserver by downloading and installing server software (the most popular is Apache, see http://www.apache.org/), though it's not recommended unless you know what you're doing!

Figure 2.1. How HTTP works: retrieving a web page


The HyperText Transfer Protocol (HTTP) is actually quite simple. The web browser (or client) makes a request of a webpage to the server, and the webserver passes the page back to the browser (see Figure 2.1, “How HTTP works: retrieving a web page”. More cleverly, it also passes back any images, sounds or other media items back to the browser too.

The web browser is also particularly clever in the way it displays what it retrieves. Web pages are written in HTML, and the browser knows how to display these correctly, whether you have a huge flat screen or a tiny screen on a handheld device or phone. The HTML language gives the browser hints on how to display things, and the browser decides the final layout itself.