Virtual Hosts
Cheat sheet · https://pcornel.dk/topic.php?topic=2877
Answer
Virtual hosts let one web server serve several sites, selected by host name (Host header and TLS SNI), IP address or port.
Remember
If no virtual host matches the name, the default (first or explicitly marked) answers — often showing another site. Each HTTPS site needs a certificate matching its name (SNI).
First checks
systemctl status nginx|apache2|httpd— web server statenginx -t / apachectl configtest— configuration testss -ltnp | grep -E ':80|:443'— listening portscurl -vI https://<name>— response, headers and TLStail -f /var/log/nginx/error.log— error log (or apache2/httpd)
Verify in this order
client sends Host/SNI → server matches a virtual host → serves its content and certificate
Where it usually breaks
First mismatch in persistent intent → provider/parser/generator → kernel/userspace runtime → dependency/security context → logs/counters → consumer-visible read-back; preserve identity/native diagnostic/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2877