Skip to content
BENIBIX Learn

Virtual Host

Infrastructure🌍 Web Serving & NginxServer Configuration

Also known as Vhost, Name-Based Virtual Host, Virtual Hosting

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

Think of it like

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

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.

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.
Two names, one server. Each name gets its own virtual host and its own folder.

Common mistake

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

Key takeaways

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

Compare