"location с регулярными выражениями обрабатываются первыми"
    Gena Makhomed 
    gmm на csdoc.com
       
    Вт Апр  3 10:30:56 UTC 2012
    
    
  
On 03.04.2012 12:49, Vladimir Rusinov wrote:
> Вкратце: запрос попадает только в один location. location с регулярными
> выражениями обрабатываются первыми. Ваши запросы попадают в один из
> location с регулярными выражениями, в которых никакого basic_auth нету.
в документации несколько более сложное описание, чем просто
"location с регулярными выражениями обрабатываются первыми"
http://nginx.org/en/docs/http/ngx_http_core_module.html#location
To find a location matching a given request, nginx first checks 
locations defined using the prefix strings (prefix locations). Among 
them, the most specific one is searched. Then regular expressions are 
checked, in the order of their appearance in a configuration file. A 
search of regular expressions terminates on the first match, and the 
corresponding configuration is used. If no match with a regular 
expression is found then a configuration of the most specific prefix 
location is used.
====================
наверное потому что
If the most specific prefix location has the “^~” prefix then regular 
expressions are not checked.
====================
и чтобы не было такой часто проверки location с регулярными выражениями
на каждый запрос - их рекомендуется делать вложенными, внутрь "обычных" 
location.
-- 
Best regards,
  Gena
    
    
Подробная информация о списке рассылки nginx-ru