title: How to exclude specific subdomains server_name in nginx configuration
body: <p>I'm using wildcard in <code>server_name</code>. I want to redirect all subdomains of <code>example.com</code> (configured as *.example.com) to <code>foo.com</code> except <code>xyz.example.com</code></p>
  
  <p>I have configuration as follows</p>
  
  <pre><code>server {
          listen          80;
          server_name     *.example.com;
          location / {
              proxy_pass      http://$1.foo.com;
          }
  }
  </code></pre>
  
  <p>I don't want to change any request coming to <code>xyz.example.com</code></p>