nginx turns off the favicon.ico robots.txt logging configuration
- 2020-05-10 23:15:14
- OfStack
nginx log recently had a large number of access to the 404 error log that favicon.ico could not find. This site feels that it is affecting the performance of the server. For a server with high concurrency, every error will affect the performance, so you need to turn off the access to the logging function of favicon.ico.
# Put the following configuration in server {} block .
# Shut down favicon.ico Log when it does not exist
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Access to hidden files is not allowed for example .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}