Note:
favicon.ico takes up a lot of information in the nginx error_log log, covering the logs we really need to view. So here, we turn it off via log_not_found off.
Implementation:
//Put the following configuration into the server {} block, and turn off logging when favicon.ico does not exist
<span>location </span><span>=</span><span>/favicon.ico { log_not_found off; access_log off; } /</span><span>/</span><span>log_not_found on</span><span>|</span><span>off</span><span>,默认为</span><span>on</span><span>:启用或禁用</span><span>404</span><span>错误日志,这个指令可以用来禁止</span><span>nginx</span><span>记录找不到</span><span>rebots</span><span>.</span><span>txt</span><span>或</span><span>favicon</span><span>.</span><span>ico</span><span>这类文件的错误信息。</span>
Appendix:
1. I saw a sentence on the Internet saying: Note that error_log off does not close the log Logging function, it writes the log file to a file named off. If you want to turn off the error logging function, you should use the following configuration: error_log /dev/null crit;
off location is /usr/local/nginx/ off, that is, in the installation directory of nginx
2. Changing log_not_found off to error_log off has the same effect. The difference is that writing error_log off outputs the error log to the off file, while log_not_found closes the log.
Reprinted from: http://coolnull.com/1516.html
The above introduces nginx to ignore the faviconico log, including favicon and iconic content. I hope it will be helpful to friends who are interested in PHP tutorials.