Nginx 1.27 · vhost B

Different site. Same Nginx worker.

Same container, same listen 80, same worker process as site A and as the lab index page. Three server blocks, three roots; the Host header alone decides which one you get. This one stamps X-Lab-Vhost: nginx site-b.

A vs B, side by side

vhost Avhost B
Host headernginx-a…nginx-b…
root/srv/site-a/srv/site-b
X-Lab-Vhostnginx site-anginx site-b
Config fileconf.d/site-a.confconf.d/site-b.conf
Processthe same nginx worker

The trap: the default server

When no server_name matches, Nginx does not error — it silently hands the request to the default server for that listen address: the first block loaded, or whichever one is marked default_server. Apache behaves the same way, falling back to the first vhost.

This is the single most confusing virtual-host symptom, and the module's "works on one domain but not another" case. The site is not down; a different site answered. A typo in server_name, or a config file that never got symlinked into sites-enabled/, produces exactly this.

# which block claims the default for this port?
nginx -T | grep -n -E 'server_name|listen|default_server'

# ask directly, bypassing DNS -- send any Host you like:
curl -s -H 'Host: typo.srv1957161.hstgr.cloud' http://127.0.0.1/ -o /dev/null -w '%{http_code}\n'

Keep exploring

← vhost A Apache equivalent → Lab index