Home > Article > Backend Development > nginx ignores faviconico logs favicon.ico 404 online favicon favicon 1 htm disease
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
location =/favicon.ico { log_not_found off; access_log off; } //log_not_found on|off,默认为on:启用或禁用404错误日志,这个指令可以用来禁止nginx记录找不到rebots.txt或favicon.ico这类文件的错误信息。
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.