# Web Hosting Concepts

> Understanding where websites live, from shared servers to modern global edge networks.

Subject: Internet | Lesson 20 of 35 | 5 min read
Interactive lesson: https://codewithanimation.in/internet/web-hosting-concepts
Previous: [Preflight Requests](https://codewithanimation.in/internet/preflight-requests.md) | Next: [Web Servers vs. App Servers](https://codewithanimation.in/internet/web-vs-app-servers.md)

## What it is

Web Hosting is a service that allocates space on an internet-connected server to store and serve the files that make up a website.

**Shared Hosting**: Multiple websites share a single physical server's resources. It's cheap but prone to slowdowns if a 'noisy neighbor' gets too much traffic.

**VPS (Virtual Private Server)**: A physical server partitioned into isolated virtual servers, offering dedicated resources and more control.

**Dedicated Hosting**: Renting an entire physical server for maximum performance and configurability.

**Serverless / Static Hosting**: A modern approach where static assets (HTML, CSS, JS) are distributed globally via a Content Delivery Network (CDN) and backend logic runs in serverless functions, eliminating traditional server maintenance.

## Why it matters

To share your website with the world, it must move off your `localhost` and onto a server accessible via the public internet.

Understanding different hosting models helps you choose the right deployment strategy for your frontend assets, balancing cost, performance, and scalability.

## How it works

When you publish a website, you upload your files to the hosting provider's web server.

When a user types your domain name into their browser, the DNS system routes their HTTP request to your server's IP address.

The web server software (like Apache or Nginx) receives the request, locates the requested files on its hard drive, and sends them back to the user's browser.

## Common mistake: The 'I have to buy a physical server' trap

A common misconception for beginners is thinking they need to buy and run a physical server in their house 24/7 to host a website.

In reality, cloud hosting and static deployment platforms abstract away all hardware management, allowing you to deploy sites globally in seconds.

## Tip: Pro tip

Treat your modern frontend like a collection of static documents. Instead of renting a VPS and manually configuring Nginx, use platforms like Vercel, Netlify, or GitHub Pages.

These platforms connect to your Git repository, build your code automatically on every push, and distribute your site globally.

## Try it: Try it

Explore the different hosting environments and see how they handle traffic spikes.

The animation is on the lesson page and is not part of this text version: https://codewithanimation.in/internet/web-hosting-concepts

## Check yourself

### Question 1

Which hosting model allows you to deploy frontend applications by automatically pulling from your Git repository without configuring any traditional web server software?

- A. Dedicated Hosting
- B. Shared Hosting
- C. VPS Hosting
- D. Serverless / Static Hosting

Correct answer: D

Static hosting platforms automate the build and deployment process, distributing your assets via CDNs without requiring you to manage traditional servers.

- Why not A: Requires renting an entire physical server and manually configuring all server software.
- Why not B: Involves uploading files manually via FTP to a pre-configured traditional server.
- Why not C: Gives you a virtual machine where you are responsible for installing and maintaining the web server yourself.

### Question 2

What is a major disadvantage of Shared Hosting for a growing web application?

- A. You have to manage all the physical hardware yourself.
- B. Your site's performance can drop if other websites on the server get traffic spikes.
- C. You cannot host basic HTML, CSS, and JS files.
- D. You must write your own web server software from scratch.

Correct answer: B

In shared hosting, resources (CPU, RAM, bandwidth) are split among all tenants, meaning one high-traffic site can negatively impact all others on the same server.

- Why not A: The hosting provider manages all physical hardware for you.
- Why not C: Shared hosting is fully capable of serving basic static files.
- Why not D: Shared hosting comes with standard web servers like Apache pre-installed.

### Question 3

What is the primary role of the web server when a user visits your URL?

- A. To receive incoming HTTP requests and send back the appropriate files.
- B. To translate the domain name into an IP address.
- C. To execute client-side JavaScript to make the page interactive.
- D. To design the visual layout of the website.

Correct answer: A

The core function of a web server is to listen for incoming HTTP requests, locate the requested resources, and respond with them.

- Why not B: Domain translation is handled by Domain Name System (DNS) servers.
- Why not C: Client-side JavaScript is executed by the user's web browser, not the server.
- Why not D: Visual layout is determined by the CSS written by the developer and rendered by the browser.

## Remember this

- Web hosting moves your code from localhost to the public internet.
- Shared, VPS, and Dedicated hosting offer different trade-offs of control and performance.
- Modern frontends are best deployed on Static/Serverless platforms.
