How Does a Web Server Work?

How Does a Web Server WorkFor many people hosting websites, what their web server is or does is somewhat mysterious. But in general terms, web servers are quite simple.

Before getting into the specifics of how web servers work, we need to first understand what a server is. In the simplest terms, a server is a device (such as a computer) the purpose of which is to provide services to other devices. These services are essentially programs that allow for other programs to connect to them for certain purposes. By way of illustration, let’s take an example common to many people’s lives: Netflix. Netflix maintains a large infrastructure of servers that stream content to subscribers. When you launch your Netflix app on your tablet or TV, you are starting a program locally, on your device, which then connects to another program (the service) hosted on Netflix’s servers. Upon logging in, the service sends data to your app, such as what you have previously watched, what you might want to watch, and streaming video based on what you have selected.

This setup is called the client-server model. In the example of Netflix, the app on your tablet or TV is the client, and the service that it connects to on Netflix’s side is the server.

When it comes to website hosting, the model is exactly the same, though the functionality of the services offered is different, as is the functionality of the clients used to interact with those services.

Firefox LogoFor most people hosting a website, two services are generally at the forefront: the website itself, and email. The website is, of course, your system of pages that you view in your browser. In this case, your browser (whether it is Chrome, Firefox, Opera, or something else) is the client. When you type your website’s URL into your browser’s address bar, you are directing the browser to connect to the service running on the web server that is responsible for your web content. (To learn how your computer figures out which server to connect to based on the web address you entered check out our article What is DNS?) That service, which is often Apache but can be another program, then replies to your browser’s request by sending it data, typically in the form of HTML and CSS. Your browser then renders that data so that it looks the way you’ve designed it. (Some people will, no doubt, recall the occasional headache of dealing with browsers that render that data a little differently.) Clients and services that handle websites communicate with each other over HTTP or Hypertext Transfer Protocol. “HTTP” is, of course, something most readers will recognize from their browser’s address bar, as is “HTML”, which stands for Hypertext Markup Language.

Web technology has become sophisticated enough that many ordinary websites now use much more than HTTP and HTML. Popular content management systems such as WordPress or Joomla, for example, also require PHP and a database such as MySQL. PHP is a server-side only programming language, meaning that it does not interact with a client. But MySQL also follows the client-server model, though the client is typically local to the server itself. Furthermore, many website owners are beginning to implement SSL, a security protocol used to encrypt traffic between clients and servers (you may have noticed “HTTPS” in your address bar before).

EmailEmail is another client-server technology that web servers typically implement, but unlike a website, which uses one service, email uses two: one that is responsible for sending and receiving mail and one that you use to retrieve mail that has been sent to you. If you use an email app on your phone or computer, your app will periodically connect to the email service running on your server to check for any new mail. That service will, in response, reply by sending your client data that includes not just the content of your emails, but metadata that contains information such as the sender’s address, the time the email was sent, and the server that sent it. The protocol being used here is generally either IMAP, or Internet Message Access Protocol, or POP, which stands for Post Office Protocol.

Similarly, when you send an email from your app to a friend, your client connects to your server’s mail transferral service and transmits its message. That service then contacts its counterpart on the server hosting your friend’s email and delivers your message. The same process occurs when your friend emails you. Here the protocol is usually SMTP, or Simple Mail Transfer Protocol.

As with web technology, email usage often involves more than the bare, original email protocols. These days many people go through a webmail interface rather than using an app. And more of those who do use apps are connecting over SSL.

There are many other services that can be run on a server, but web servers specifically tend to revolve around services directly related to websites and email, and, in some cases, storage. Be sure to read our reviews of the various hosting companies to find out what they offer.

Web Hosting Sun
Logo
Register New Account
Reset Password