How to turn off logging for favicon and robots in nginx for flask (python) apps
<p>I'm trying to find a way to turn off logging for favicon.ico and robots.txt in my <strong>NGINX</strong> web server powering a <strong>Flask (Python)</strong> app through <strong>uWSGI</strong>.</p>

<p>So, the first part of my nginx config is:</p>

<pre><code>location / {
    try_files $uri @app;
}

location @app {
    include uwsgi_params;
    uwsgi_pass unix:/srv/www/uwsgi.sock;
}
</code></pre>

<p>Now, when I add (above the code block displayed above)</p>

<pre><code>location = /favicon.ico {
    access_log off;
    log_not_found off;
}

location = /robots.txt {
    access_log off;
    log_not_found off;
}
</code></pre>

<p>I get <strong>404 not found errors</strong> when I visit those URIs. Now when I remove the <strong>=</strong> sign in <strong>location = /...</strong> the URI does work and I see the favicon and robots file. But for some reason it still access logs those requests.</p>

<p>What seems to be going on here?</p>