curl -I -H 'Host: example.com' http://localhost

Category: Web Servers & Proxies

curl -I -H 'Host: example.com' http://localhost

Check which virtual host answers for a domain

The Host header tells nginx which virtual host (vhost = one site served by one server) should handle the request, even though you connect to localhost. Useful to test a site before DNS points example.com at this machine. Compare responses across Host values to confirm each vhost is wired up.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.