- Asked 2/10
- 2074 Magh · 4 marks
- 2072 Asoj · 4 marks
Short note: Web virtual hosting
Short answer
Virtual hosting runs multiple web sites on one physical server, primarily via name-based Host header matching, reducing cost and IP usage. It is configured with VirtualHost blocks in Apache or server blocks in Nginx, each with its own document root and settings.
Write a short note on Web virtual hosting.
Web virtual hosting is the practice of hosting several web sites (domains) on one physical web server, so that each site appears to have a dedicated server. It cuts hardware, power and IP address costs, and is the basis of shared web hosting by ISPs and hosting companies.
Types
| Type | Site is selected by |
|---|---|
| IP-based | The server IP address the request arrived on |
| Port-based | The TCP port number |
| Name-based | The Host: header in the HTTP/1.1 request |
- IP-based: each site gets its own IP address (several NICs or IP aliases). Works for all clients and HTTPS but consumes addresses.
- Port-based: one IP, sites on ports 80, 8080, ...; users must type the port, so it is rare for public sites.
- Name-based: many names on one IP; the most common. Needs HTTP/1.1 and (for HTTPS) SNI support.
Apache example (name-based)
<VirtualHost *:80>
ServerName www.a.com
DocumentRoot /var/www/a
</VirtualHost>
<VirtualHost *:80>
ServerName www.b.com
DocumentRoot /var/www/b
</VirtualHost>
Both names point in DNS to the same IP address. Each site has its own document root, logs and configuration. IIS and Nginx (server_name) support the same idea.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- HTTP request methods; web server and virtual hosting · Internet and Intranet, chapter 4
- Virtual hosting types; name-based steps · Internet and Intranet, chapter 4 · asked 2×
- Virtual hosting and HTTP connections · Internet and Intranet, chapter 4
- HTTP working, methods, virtual hosting · Internet and Intranet, chapter 4