Web Hosting

⏱ 6 min read

In one sentence: Web hosting means keeping a website's files on a server that is connected to the internet, so anyone can visit the website at any time.

Why should I care?

Every website you have visited is stored on a Server somewhere. Keeping a website's files on a server, and keeping that server running, is called web hosting. A company that does it for others is called a web host or a hosting provider.

To let the world see your own web page, you will need hosting.

Analogy

Think of a market hall: one big building, open every day, with many small stalls inside. You rent a stall and put your goods on it. The owner keeps the building working and open. Visitors come to see your goods.

The building is the server computer. Your stall is a part of its storage. Your goods are your website's files. The owner is the hosting provider.

Where the analogy breaks down: market visitors take goods away. A server sends each visitor a copy of your files, so the files never run out. Also, the same website can be stored on several servers at the same time. A stall can only be in one place.

How it actually works

A website is a set of files

A simple website is a group of files: HTML files (plain text files that describe a page's structure), plus images and other files. MDN, a website that documents how the web works, says a web server must store "the website's files".

Hosting means: stored, connected, always on

MDN says you could host these files on your own computer, but a server from a hosting provider is usually better:

  • It is "typically more available": up and running more of the time.
  • It is always connected to the internet, except when it has problems.
  • It can keep the same IP address all the time. This matters because your domain name will point to your server's IP address. MDN notes that not every internet provider gives homes a fixed IP address.
  • Someone else usually looks after it.

How a visitor reaches your files

A domain name is a name like wikipedia.org, typed instead of an IP address. A domain name and hosting are different things. You rent a domain name from a company called a registrar. Some hosting providers are also registrars. DNS connects the two. At your DNS provider (a service that runs the DNS servers for your domain; most registrars include one), you add a record: one piece of information, such as "this name points to this IP address".

Scroll sideways to see the whole diagram →

How your files and your domain name reach a visitorStep 1, you upload your files to a server at a hosting provider. Step 2, you add a DNS record that points your domain name to the server's IP address. Step 3, a visitor's browser asks DNS for the IP address of your domain name and gets it back. Step 4, the browser asks your server for the page. Step 5, the server sends a copy of your files.BrowserDNSServerYou1. Upload files2. Add a record3. IP address ofname?The IP address4. Send me the page5. Copy of the files
  1. You upload your files (when you have made them): you copy them from your computer to the server.
  2. You add a DNS record for your domain.
  3. A visitor types your domain name. Their browser asks DNS for the IP address and gets it back.
  4. The browser asks your server for the page.
  5. The web server program sends a copy of your files.

Static and dynamic websites

MDN describes two ways a server can send a website:

  • A static website is sent "as-is": the server sends the same files to every visitor. MDN suggests that your first site should be a static site.
  • A dynamic website uses extra programs on the server. They can create a page when a visitor asks for it, for example by filling a page template with data from a database (a storage system for organized data). Sites like Wikipedia work this way.

Kinds of hosting

Wikipedia lists several kinds of hosting. You do not need to remember them all:

  • Shared hosting: many websites on one server, sharing its CPU and memory. Like the market hall.
  • Dedicated hosting: you get a whole server for yourself, but usually do not own it.
  • Cloud hosting: many servers work together, so another one can take over when one breaks. (More in Cloud Computing: What "the Cloud" Really Is.)
  • Static page hosting: a service only for static files. Wikipedia names GitHub Pages and Cloudflare Pages as examples.
  • Home server: you run the server yourself, often on an old personal computer with a home internet connection.

What it costs

MDN says hosting services "range from free to thousands of dollars per month". Some free hosting providers "may add advertising to your content", MDN warns. Static hosting can be free. GitHub is a website where you can store your code and files. Its GitHub Pages service works with GitHub's free plan, if your files are public (anyone can see them).

How it came to be

CERN is a laboratory in Geneva, Switzerland, where scientists study the Universe. CERN says the first web server was running there by the end of 1990. The first website and web server had the address info.cern.ch, and ran on a NeXT computer.

At first, a website needed its owner's own server. Not every company had the money or skills for that, so web hosting services started to keep other people's websites on their servers. By 1995, companies such as GeoCities, Angelfire and Tripod offered free hosting.

🧪 Try it in your browser

You will look at a file that CERN hosts, then find its server. You need a computer, not a phone. This changes nothing.

  1. Open https://info.cern.ch/hypertext/WWW/TheProject.html in Chrome, Edge or Firefox. You see the heading "World Wide Web". CERN calls this "the first website".
  2. Show the file that the server sent. On Windows, press Ctrl + U. On a Mac, press Cmd + Option + U in Chrome, or Cmd + U in Firefox. In any browser, you can also right-click an empty part of the page (on a Mac: hold Control and click) and choose the item View page source (or a similar name).
  3. What you should see: a new tab with plain text. You see words in angle brackets, like <TITLE> and <H1>. This is the HTML file that CERN's server sent to your browser. Close this tab when you are done.
  4. Now find that server. Open https://dns.google/query?name=info.cern.ch. This is Google's public DNS lookup page.
  5. Find the part that starts with "Answer". You may see "type": 5 first. Type 5 means an alias: info.cern.ch is a nickname for another name. Its "data" shows the real name behind the alias.
  6. Look further down for "type": 1. Type 1 is an address. Its "data" is an IP address: four numbers separated by dots. This is the address of the server that hosts the page.

What you did: you saw a hosted file and its server's address. The values may change over time.

Common misunderstandings

  • "My domain name is my hosting." No. The domain is the name. Hosting is the server that stores the files.
  • "Hosting always costs a lot." No. A small static site can be hosted for free.

Recap

  • Web hosting means storing a website's files on a server that is always on and connected to the internet.
  • A domain name and hosting are separate. A DNS record points the name to the hosting server.
  • Hosting comes in many kinds, from free static hosting to whole servers.

Sources

Written with AI · Reviewed by AI · Not yet checked by a human

Found a mistake, or something you did not understand? Report a problem.