查看日志可以看到

192.168.33.1 - - [26/Mar/2020:04:00:49 +0000] "GET / HTTP/1.1" 200 54 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
192.168.33.1 - - [26/Mar/2020:04:00:49 +0000] "GET /favicon.ico HTTP/1.1" 200 54 "http://2020.nginx.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"

其实favicon.ico的请求也被nginx分配给php处理了,造成了程序执行两次的结果。

在nginx配置的server 里面把favicon.ico 处理一下就可以了

     # set site favicon
      location /favicon.ico {
          root html;
      }
Last modification:March 26, 2020
如果觉得我的文章对你有用,请随意赞赏