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.
| vhost A | vhost B | |
|---|---|---|
| Host header | nginx-a… | nginx-b… |
root | /srv/site-a | /srv/site-b |
X-Lab-Vhost | nginx site-a | nginx site-b |
| Config file | conf.d/site-a.conf | conf.d/site-b.conf |
| Process | the same nginx worker | |
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'