Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable 404 error logging

Tags:

nginx

In my configuration, I'm using:

error_page  404  /switch;

When I browse to /testABC, I see this error in my log:

open() "/usr/local/nginx/html/www/testABC" failed (2: No such file or directory)

How can I disable this error? I'm currently using the 404 as part of the site functionality.

like image 453
iRyanBell Avatar asked Nov 30 '13 12:11

iRyanBell


1 Answers

If you don't want 404 errors to show in your nginx error logs, log_not_found is the directive you want to configure.

By default, log_not_found is set to "on" which will report file not found errors in your main error log. To turn these off, just do:

log_not_found off;

Source: http://nginx.org/en/docs/http/ngx_http_core_module.html#log_not_found

like image 187
jsdalton Avatar answered Nov 08 '22 15:11

jsdalton