在我的配置中,我使用:
error_page 404 /switch;
当我浏览到/testABC 时,我在日志中看到此错误:
open() "/usr/local/nginx/html/www/testABC" failed (2: No such file or directory)
如何禁用此错误?我目前使用 404 作为站点功能的一部分。
最佳答案
如果您不想在 nginx 错误日志中显示 404 错误,log_not_found
是您要配置的指令。
默认情况下,log_not_found
设置为“on”,这将在主错误日志中报告文件未找到错误。要关闭这些,只需执行以下操作:
log_not_found off;
来源:http://nginx.org/en/docs/http/ngx_http_core_module.html#log_not_found
关于nginx - 禁用 404 错误日志记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20300199/