title: Only serve site for specific domain with nginx
body: <p>I have a domainname (say: example.com) for which i set the DNS records like this:</p>
  
  <pre><code>*.example.com   A   IP_ADDRESS
  example.com     A   IP_ADDRESS
  www.example.com CNAME example.com
  </code></pre>
  
  <p>This means all requests for this domain (including subdomains) will be routed to my server with address IP_ADDRESS.</p>
  
  <p>On my server I have an nginx http server running, with server settings like this:</p>
  
  <pre><code>server {
      server_name demo.example.com;
  
      // Location blocks here
  }
  </code></pre>
  
  <p>The behaviour I expect is that the site will only be shown when demo.example.com, while going to anything.example.com or just example.com will result in nginx giving an error. </p>
  
  <p>But this is not the case, what I am actually seeing is that while i have my server_name specifically set to demo.example.com, all requests on every subdomain for this domain will route to this site. So going to anything.example.com will result in seeing the site which I only want to show when going to demo.example.com.</p>
  
  <p>So, I suspect I am just being stupid here and I've misconfigured something, but could someone please tell me how to get what I expect?</p>