42

How to I get rid of all the below errors in nginx. I do not have a favicon.ico

2012/03/11 17:13:25 [error] 959#0: *116 open() "/usr/local/nginx/html/favicon.ico" failed (2: No such file or directory), client: 111.68.59.75, server: 127.0.0.1, request: "GET /favicon.ico HTTP/1.1"  

I would imagine some line in nginx conf?

Tampa
  • 75,446
  • 119
  • 278
  • 425

3 Answers3

69
location = /favicon.ico {
  log_not_found off;
}
palerdot
  • 7,416
  • 5
  • 41
  • 47
Alexander Azarov
  • 12,971
  • 2
  • 50
  • 54
  • 4
    One should mention that this is a nginx setting. ``Edit the file /etc/nginx/sites-available/owncloud.conf`` (or similar) and add this. Then restart ``nginx`` OC community seems to discuss this topic as well. – Powerriegel Feb 04 '16 at 19:36
  • I'm using Elastic Beanstalk to run a Ruby on Rails application. I don't see any `/etc` folder, but i still get regular `/favicon.ico` not found errors. Where can i set a similar configuration for Elastic Beanstalk? – Jeremy Moritz Feb 25 '19 at 13:20
  • @JeremyMoritz I am not familiar with AWS EB setup, but maybe this is what you are searching for? -- https://stackoverflow.com/questions/23709841/how-to-change-nginx-config-in-amazon-elastic-beanstalk-running-a-docker-instance – Alexander Azarov Feb 25 '19 at 18:33
  • thanks, that was working perfectly. Is it a bad practice, or would there be a better place to "ignore" the favicon? – Pfinnn Jun 21 '22 at 12:42
  • @Pfinnn please post your answer if you know a better way. – Alexander Azarov Jun 22 '22 at 08:06
33

The best solution for me is:

location = /favicon.ico {
  return 204;
  access_log     off;
  log_not_found  off;
}
pprishchepa
  • 997
  • 1
  • 9
  • 21
0

/etc/nginx/sites-available/fileName

server {
    listen 80;
    listen [::]:80;

    root /var/www/html;
    index index.html;
    
    location = /favicon.ico {
        return 204;
        access_log off;
        log_not_found off;
    }
}
zorro
  • 101
  • 1
  • 10