Web Server

Share

What is a Web Server?

A web server is a server that serves webpages. This could refer to the software that acts as an HTTP server, such as Apache and Nginx, or it could refer to a physical computer connected to the Internet that's running one of the software web servers.

When you access a website with a URL, the URL typically contains a domain name, like www.virtualcuriosities.com. Your web browser connects to a DNS server to ask the IP address for the server associated with this domain name. Then, it tries to connect to the IP address given using web protocols such as HTTP (port 80) and HTTPS (port 443). If the computer at that IP address is running a software that can respond correctly to requests sent to the standard web protocol ports, then it's a web server.

One thing sent to the web server as part of the request is the URL path of the accessed webpage. For example, if you're trying to access /about, your web browser will ask for the resource with the path /about, and the web server will respond with the HTTP status code 200 OK if the resource exists, or 404 NOT FOUND if such resource can't be found on the web server. There are also other codes it can respond with, such as 403 FORBIDDEN, or 302 FOUND (in which case, you'll be redirected to a different URL).

To have a website on the Internet, you need a web server. This web server could run on your PC, but it would only work if your ISP gave you a static IP address (normally residential zones get dynamic IPs which change all the time), and it didn't block traffic to standard ports like HTTP (some ISPs block this traffic to residential zones), and you would need to leave your PC powered all the time or else your website would go down. Normally, people don't do this. They just pay a company that manages a bunch of computers connected to the Internet that are running web server software. These are called web hosts. Some of them will even host your website for free, specially if it's something that doesn't consume a lot of resources, like static HTML pages.

Types of Web Server Hosting Plans

If you pay a web host to have a web server to serve your website, that doesn't mean you actually own a whole computer. Generally, web hosting can be split into three tiers:

Dedicated hosting: you pay for the physical server, which means you can choose which processor or other hardware you want.

VPS (Virtual Private Server): you pay for an operating system with dedicated resources. This means there is one computer with multiple operating systems running inside of it through a technology called virtualization.

Your website shares the same processor and memory as other VPS's on the same machine, but you have a dedicated amount of memory and CPU time that is always available for you and will never be given to other customers. You can install any software you want because you own the operating system.

Shared hosting: you pay to be a user in an operating system that is running a web server.

You can upload your files to some directories that the web server will serve for you. You can't install whatever you want, but you can install certain things if the system is configured to allow you to.

The web server program can be serving hundreds of users on the same machine, which means that if one website gets a lot of traffic, the web server program will be too busy serving it to serve the other users' websites.

In essence, shared hosting is cheaper, but less customizable and less stable, because you're sharing resources with other users. Most websites have very little traffic. If you had a VPS with a lot of CPU time and memory dedicated to your website, those resources would go unused because nobody is accessing your website most of the time. Meanwhile, with shared hosting, there would be several websites being served by the same machine, so the tiny amount of traffic that each website gets would add up to use a considerable portion of the machine's resources.

Shared hosting's price is a reason why PHP is more popular than Python when it comes to making websites, even though Python is the best programming language in the world. Since you can't just install whatever software you want in a shared host, that means what you can use depends on what the host allows you to use.

When it says in the front page of a host that they offer "Wordpress hosting" or "Drupal hosting," what it means is that PHP is installed. Although you can find web hosts that let you run websites made with Python frameworks (e.g. Flask, Django), or Javascript (Node), those are often less common and more expensive than PHP.

Written by Noel Santos.

About the Author

I'm a self-taught Brazilian programmer graduated in IT from a FATEC. In a world of increasingly complex and essential computers, I decided to use my technical expertise in hardware, desktop applications, and web technologies to create an informative resource to make PC's easier to understand.

View Comments