我已经在/etc/nginx/sites-enabled/*.conf 文件中包含了以下行,以从访问日志、favicon、php、sitemap 消息中删除:
包括access_log_rules/log_off.conf;
log_off.conf文件内容:
location = /favicon.ico {
log_not_found off;
access_log off;
}
location ~ .php$ {
access_log off;
log_not_found off;
}
location = /sitemap.xml {
log_not_found off;
access_log off;
}
问题是我无法启动nginx,遇到以下错误:
nginx: [emerg] 重复位置 "/favicon.ico" in/etc/nginx/access_log_rules/log_off.conf:1
如果我搜索该语句的重复项,则没有。 "grep -rnw '/etc/nginx' -e 'favicon.ico'">
发现问题,在 conf 文件中重复包含以下行:
include access_log_rules/log_off.conf;