Not logging access to favicon.ico

Mark Alan m6rkalan at gmail.com
Fri Jan 18 11:08:10 UTC 2013


On Fri, 18 Jan 2013 08:00:54 +0000 (GMT), Mik J <mikydevel at yahoo.fr>
wrote:
> Thank you guys, so I'll put a somilar configuration as below for all
> my virtual hosts: # cat /etc/nginx/sites-available/default
> server {
>         listen 80 default_server;
>         server_name _;
>         index index.html;
>         root /var/nginx/html;
>         access_log /var/log/nginx/default.access.log;
> 
>         location /favico {
>         access_log off;
>         error_log /dev/null crit;
>         empty_gif;
>         }
> }

There is no need to use the 'empty_gif' blob or the related
 ngx_http_empty_gif_module anymore.

Try this instead:

location = /favicon.ico { access_log off; log_not_found off; expires
30d; try_files /favicon.ico =204; }

Regarding that 204 status code, do see:
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#204

r.

M



More information about the nginx mailing list