Everyone knows what a web server is right? For the average user out on the Internet its a far away machine that makes websites appear on your computer, from a web masters point of view its the thing that makes your websites live and your hosting company sort of makes it work. the reality of course it that most people don’t really know what a web server is, or exactly how it does what it does.
Breaking down the web server
A web server is indeed a server, sometimes many servers acting as one, that serves web pages to users all over the Internet.
A web server will typically run on Linux and sometimes on Windows and has software that is capable of storing web pages, handling requests from Internet users as they surf the web using their favorite web browser.
When a user requests Google.co.uk for example, Google’s web servers will receive that request and respond by sending out the HTML file, amongst other elements, that make up the Google homepage. The users browser will then interpret these files and compile the Google homepage on the users computer.
This is a very brief overview and it is just the basic theory of how a web server works in general, in reality it is much more complicated and there are normally lots of other components involved as well as many more parts to the process of fulfilling web page requests.
PHP Based Web Server
To explain the concept of the web server in more detail, Mario Döring has coded a web server using the web programming language PHP. Mario’s web server will listen for, accept and respond to web requests appropriately using a backend consisting purely of PHP code.
This PHP script has been put together by Mario with the intention of demonstrating exactly how a web server works and aims to show beginners how easy it is to put together a simple web server and how this can be achieved using almost any programming language.
The entire code for the project as well as a detailed explanation of every step is available on Mario’s blog. It is a very interesting article and well worth a read for web programmers in particular but also for anyone who has an Interest in how one of the key components that make up the Internet actually works.