try_files / if / access_log question

Francis Daly francis at
Fri May 23 18:52:50 UTC 2014

On Fri, May 23, 2014 at 12:22:08PM -0400, sfrazer wrote:

Hi there,

> The try_files config is the new part, everything was working fine before I
> added that.

> 		location / { 
> #			if ($ignore_ua) { access_log off; }
> 			try_files $uri/index.cchtml @gunicorn;
> 		}

> What am I doing wrong here?

You are using "if" inside "location" without understanding the
subtleties. The safest option is not to do that.

I suspect that the simplest option will be to use a newer nginx which
can do conditional logging without the "if" directive.

Failing that, then -- untested! -- you might have luck if you duplicate
the try_files line inside the "if" block.

Francis Daly        francis at

More information about the nginx mailing list