【问题标题】:Nginx and favicon.ico - "GET /favicon.ico HTTP/1.1" FAILEDNginx 和 favicon.ico - “GET /favicon.ico HTTP/1.1”失败
【发布时间】:2012-03-28 06:17:19
【问题描述】:

我如何摆脱 nginx 中的所有以下错误。我没有 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"  

我会想象 nginx conf 中的某些行?

【问题讨论】:

    标签: nginx


    【解决方案1】:
    location = /favicon.ico {
      log_not_found off;
    }
    

    【讨论】:

    • 应该提到这是一个 nginx 设置。 Edit the file /etc/nginx/sites-available/owncloud.conf(或类似)并添加此内容。然后重启nginxOC社区好像也在讨论这个话题。
    • 我正在使用 Elastic Beanstalk 运行 Ruby on Rails 应用程序。我没有看到任何/etc 文件夹,但我仍然经常收到/favicon.ico 未找到错误。我在哪里可以为 Elastic Beanstalk 设置类似的配置?
    • @JeremyMoritz 我不熟悉 AWS EB 设置,但也许这就是您要搜索的内容? -- stackoverflow.com/questions/23709841/…
    【解决方案2】:

    对我来说最好的解决方案是:

    location = /favicon.ico {
      return 204;
      access_log     off;
      log_not_found  off;
    }
    

    【讨论】:

    • 请注明我们必须添加此配置的文件名。
    • @VishalShetty 在您的站点服务器部分内/etc/nginx/sites-enabled/mysite.com
    猜你喜欢
    • 1970-01-01
    • 2015-02-05
    • 2016-05-26
    • 2017-12-20
    • 1970-01-01
    • 1970-01-01
    • 2011-06-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多