Introduction
When you run a website on a server, you need to tell the server which website to show when someone types a web address. The server_name directive in nginx helps the server know which website to serve based on the web address the visitor uses.
When you host multiple websites on the same server and need to direct visitors to the right site.
When you want to respond to different domain names or subdomains with different content.
When you want to set a default website for requests that don't match any specific domain.
When you want to handle www and non-www versions of your website separately.
When you want to use wildcard domains to catch many subdomains with one configuration.