Nginx-favicon.ico(Nginx-favicon. ico)

favicon.ico 文件是浏览器收藏网址时显示的图标,当客户端使用浏览器问页面时,浏览器会自己主动发起请求获取页面的favicon.ico文件,但是当浏览器请求的favicon.ico文件不存在时,服务器会记录404日志,而且浏览器也会显示404报错。

#一:服务器不记录访问日志:
  #location = /favicon.ico {
   #log_not_found off;
   #access_log off;
  #}
#二:将图标保存到指定目录访问:
  #location ~ ^/favicon\.ico$ {
 location = /favicon.ico {
  root  /data/nginx/html/pc/images;
  expires 90d; #设置文件过期时间
 }

这个图标是浏览器缓存小图标

————————

favicon. ICO file is the icon displayed when the browser collects the web address. When the client uses the browser to ask for a page, the browser will actively initiate a request to obtain the favicon of the page ICO file, but when the browser requests favicon When the ICO file does not exist, the server will record 404 log, and the browser will also display 404 error.

#一:服务器不记录访问日志:
  #location = /favicon.ico {
   #log_not_found off;
   #access_log off;
  #}
#二:将图标保存到指定目录访问:
  #location ~ ^/favicon\.ico$ {
 location = /favicon.ico {
  root  /data/nginx/html/pc/images;
  expires 90d; #设置文件过期时间
 }

This icon is a small browser cache icon