either error log empty or access log empty

Francis Daly francis at daoine.org
Sun Mar 25 22:12:36 UTC 2012

On Sun, Mar 25, 2012 at 04:20:54PM -0400, zhnupy wrote:

Hi there,

> I have a location definition which turns off the access log,
> but it doesn't suppose to fire every time, just for specific file
> extensions,  here is the entire server block:

If you look through the debug log for one request, you'll see exactly
why things happen.

When you request "/notthere.php", it uses the "null" location, and returns
404. Then your error_page directive causes a rewrite to /404.html, which
uses the "extensions" location. That is where the request finishes,
so that is where it is logged. And you have access_log off there.

> for instance, this URL:  http://DOMAIN_A/aaaa.txt  is not supposed to
> fire that rule, but it does.

It shouldn't match that rule if it doesn't generate a 404.

All 404s will match that rule, because of your error_page configuration.

Maybe you want a separate "location = /404.html{}" block?

Francis Daly        francis at daoine.org

More information about the nginx mailing list