Web / NGINX Interview questions
Define a virtual host in NGINX?
In NGINX, a virtual host is implemented as a server block that responds to a specific server_name, IP, and port combination. It lets one physical machine host multiple distinct websites.
server { listen 80; server_name shop.example.com; root /var/www/shop; } server { listen 80; server_name blog.example.com; root /var/www/blog; }
When a request arrives, NGINX inspects the Host header and matches it against each server block's server_name values, serving content from whichever block matches - or a designated default server block if none do.
More Related questions...