access log off nginx not working ?

gyre007 nginx-forum at nginx.us
Fri Jul 6 23:45:29 UTC 2012


I have the following drop.conf files located in /etc/nginx/drop.conf

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { allow all; access_log off; log_not_found off;
}
location = /apple-touch-icon.png { access_log off; log_not_found off; }
location = /apple-touch-icon-precomposed.png { access_log off;
log_not_found off; }
location ~ /\. { deny all; access_log off; log_not_found off; }
location ~* ^/wp-content/uploads/.*.php$ {
    deny all;
    access_log off;
    log_not_found off;
}
location ~* /files/(.*).php$ {
    deny all;
    access_log off;
    log_not_found off;
}

Strange thing is when I include it in whichever server directive - ie in
whichever virtual host I have configured - I'm still getting favicon
logs in my access log. Is this a BUG ?? 
It looks like the include is simply not working ?

Example of the virtual host I'm including this in:

server {
        listen       127.0.0.1:8080;
        server_name  .somehost.com;
    root  /var/www/somehost.com;

        access_log /var/log/nginx/somehost.com-access.nginx.log main;
    error_log  /var/log/nginx/somehost.com-error.nginx.log;

        location ~* \.php.$ {
        # Proxy all requests with an URI ending with .php*
        # (includes PHP, PHP3, PHP4, PHP5...)
        include /etc/nginx/fastcgi.conf;
        }

        # all other files
        location / {
            root  /var/www/somehost.com;
        }

        error_page 404 /errors/404.html;
        location /errors/ {
                alias /var/www/errors/;
                internal;
        }

        #this loads custom logging configuration which disables favicon
error logging
        include /etc/nginx/drop.conf;
}

yet in access logs for that domain im still seeing:

***** - - [06/Jul/2012:22:16:05 +0000]  "GET /favicon.ico HTTP/1.1" 404
134 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)
AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47
Safari/536.11"
Yes I have restarted and reloaded nginx.

When I add a specific location directive directly to the virtual host
above and disable the include by commenting it in,  favicon.ico requests
ARE STILL being logged. ie. I comment in include bit and add the
following to the above virtual host:

#include /etc/nginx/drop.conf;
location = /favicon.ico { access_log off; log_not_found off; }

Am I missing out something really obvious ? Or is this is a BUG ?
Cheers

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,228344,228344#msg-228344



More information about the nginx mailing list