I prefer to use individual config for each site, 

nginx.conf
<pre>
... 
include /etc/nginx/sites-enabled/*;
...
</pre>

/etc/nginx/sites-enable/somesite.conf
<pre>
server {
          listen       80;
          server_name  x.domain.com;

  location x.domain.com {
          auth_basic "Admin Login";
         auth_basic_user_file /etc/nginx/.htpasswd;
  } 


</pre>

Just my 2 cent :) It's helpful for me
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://nginx.2469901.n2.nabble.com/Matching-server-host-name-in-location-directive-tp6548405p6593276.html">Re: Matching server host name in location directive</a><br/>
Sent from the <a href="http://nginx.2469901.n2.nabble.com/">nginx mailing list archive</a> at Nabble.com.<br/>