# Virtual Host

> One web server that serves many sites. Each site has its own name and folder.

**Field:** Infrastructure  
**Category:** Web Serving & Nginx  
**Also known as:** Vhost, Name-Based Virtual Host, Virtual Hosting

## Think of it like

It is like one building with many shops. Each shop has its own name on the door.

## Definition

A virtual host lets one web server answer for many websites. Each site gets its own block of settings, with its own name and its own folder. When a request comes in, the server reads the site name the browser asked for. Then it picks the matching block. So one machine with one IP address can serve many sites.

## Example

Emma's one server holds two sites with two names. Each name has its own virtual host and its own folder.

## Why it matters

It is how one cheap server can hold many small sites.

## Common mistake

Thinking a virtual host is a virtual machine. It is just a block of settings inside one web server.

## Three principles

- **Many names.** One server, many sites.
- **Picked by name.** The browser says which site it wants.
- **Own settings.** Each site has its own folder and rules.

## Related terms

- [Web Server](https://learn.benibix.com/term/infrastructure/web-server)
- [Nginx Server Block](https://learn.benibix.com/term/infrastructure/nginx-server-block)
- [Apache HTTP Server](https://learn.benibix.com/term/infrastructure/apache-http-server)
- [Domain Name System (DNS)](https://learn.benibix.com/term/infrastructure/dns)
- [Document Root](https://learn.benibix.com/term/infrastructure/document-root)
- [Virtual Machine (VM)](https://learn.benibix.com/term/infrastructure/virtual-machine)

## Told apart from

- [Virtual Host vs Virtual Machine](https://learn.benibix.com/compare/virtual-host-vs-virtual-machine): People think a virtual host is a kind of virtual machine, and it is not. A virtual machine is a whole computer made in software. A virtual host is just a block of settings inside one web server. It lets that server answer for many site names. Both words start with virtual, but one splits a machine and the other splits a web server.

![Two site names, example.com and shop.example, both point to one server with one IP address. Inside the server, nginx.conf holds two server blocks. Each block matches one name and points at its own folder of files.](https://learn.benibix.com/diagrams/inf2-virtual-hosts.svg)

---

Source: https://learn.benibix.com/term/infrastructure/virtual-host
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
