DEV Community

Cover image for The Web For Aspiring Developers (Part II: Servers and Hosting)
Ndeye Fatou Diop
Ndeye Fatou Diop

Posted on • Originally published at frontendjoy.com

The Web For Aspiring Developers (Part II: Servers and Hosting)

Originally published on https://frontendjoy.com/blog/how-the-web-works-for-aspiring-developers-part-two-servers-and-hosting

Imagine it's your best friend's birthday šŸŽ.

You've decided to surprise him and cook its favorite food,Ā turtle with banana curry sauceĀ šŸ¢šŸ„˜.

Unfortunately, you don't know how to cook that meal. So you need:

  • IngredientsĀ - e.g: turtle, banana, ...
  • InstructionsĀ on what to put in the meal, how to mix the ingredients, how long the cooking, etc...

Similarly, to display a web page, your browser needs:

  • DataĀ (ex: images, videos, JSON, etc.) - For example, when using twitter.com, you need a list of posts.
  • InstructionsĀ on what to show, how, where. Those are stored in files (e.g: HTML, CSS, JS files)

TheseĀ must be storedĀ somewhere. That's where servers intervene.

cooking vs accessing a Web resource

What is a server?

AĀ serverĀ is a computer that provides resources to other computers calledĀ clients.
It stores data (e.g., files, images, etc.) and delivers it to clientsĀ on demand.
Think of it as aĀ 24-hour restaurantĀ that serves food to clients.

There are various types of servers :

  • Web serversĀ ā‡’ store and serve files needed to show a web page
  • Mail serversĀ ā‡’ store and deliver emails
  • Database serversĀ => store and provide data
  • Etc.

So, if you want your website available online,
you must store data + instructions on one or more servers.

Alt Text

How to get one?

Any computer, even your own, can act as a server as long as it can store and deliver information.

Big websites likeĀ google.comĀ orĀ facebook.comĀ have many servers. Think of them as restaurant chains (e.g., McDonald's, KFC).

But, like most people/companies,Ā you don't wanna own a serverĀ because :

  • They are expensive to maintain.
  • They must be up 24H/7j to serve all clients around the world.
  • They have to deliver the data fast.
  • They need to preserve the websites from security attacks.
  • Etc.

Instead, you pay šŸ’°šŸ’°šŸ’° aĀ Web hosting companyĀ (e.g.,Ā Bluehost,Ā Hostgator). These companies own servers andĀ rent some spaceĀ on them. When you store your website data on these servers, we say your website is "hosted."

Examples of servers

What are the main types of Web hosting?

Depending on your needs and budget, if you want to "host" your website, you generally haveĀ 4 optionsĀ :

  1. Shared hosting: you rent a part of a server and share its resources with other websites. This is equal to renting a room in a shared apartment: you share resources with other tenants. High traffic on them (i.e., too many visitors) will affect you.

Shared hosting vs renting a room in an apartment

  1. VPS (Virtual Private Server) hosting: you rent a larger part of a server and share fewer resources. See it like renting an apartment in a building: you have your own bathrooms/doors, but you still share some resources (water, heat, etc.).

VPS hosting vs renting an apartment in a building

  1. Dedicated hosting: you rent the whole server/computer. Think of it as renting an entire building.

Dedicated hosting vs renting a building

  1. Cloud hosting: you rent different servers. Think of it as renting many buildings. When one is inaccessible, you can still use others.

Cloud hosting vs renting multiple buildings

Conclusion

Your browserĀ needs some dataĀ to display a web page.
Powerful, 24H/7j online computers calledĀ servers store that data.
Because these are expensive, only big websites (e.g., google.com, twitter.com) have their own servers. Most useĀ Web hosting companiesĀ (e.g., BlueHost, DreamHost) that have servers and rent some "place" on it.

Top comments (0)