Concepts / Network services

Network services

Virtual host

Also called vhost, Host header, name-based hosting, server_name, server block

Many sites on one address and port, told apart by the Host header in each request.

DNS only brings the client to an address. The Host header inside the HTTP request names the site, and the server matches it against each site's names (nginx's server_name); a name it does not know goes to the default server. HTTP/1.1 requires the header: without it the server answers 400. Over HTTPS the name travels earlier too, in the TLS SNI, so the server can pick the right certificate.

See it on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab