another "nested locations" question

AJ Weber aweber at
Wed Sep 26 02:05:44 UTC 2012

I am interested in using a nesting of some sort so that I don't have to 
duplicate all the proxy- and other directives for one "special case".

Basically, I'd like a very small subset of my webapp to also write to a 
separate access-log.  When a user hits that particular page, I would 
like to log it, AND also perform all the directives for the rest of the 
site that are already configured.

Something like

location /site {
     location /site/search {
         access_log /var/log/nginx/search_access.log;
     proxy_pass ...
     proxy_redirect off;
     proxy_set_header ...

So accessing /site/search should write an entry in the "special log 
file", and then do all the "normal stuff" that location /site has itemized.

Is this possible?

Thanks again,

More information about the nginx mailing list