1

Is it possible to stop Nginx logging 403 errors?

I am using the directive:

error_log /var/www/error.log;

You can use log_not_found to stop the logging of 404s, but I can't see a way to stop the logging of 403s.

Kohjah Breese
  • 4,008
  • 6
  • 32
  • 48

1 Answers1

2

Theoretically, you can specify a named location to handle 403 and disable error logging there:

error_page 403 = @403_handler;
location @403_handler {
    error_log /dev/null;
}

Doesn't have to be a named location though:

error_page 403 /403.html;
location = /403.html {
    error_log /dev/null;
}
Danila Vershinin
  • 8,725
  • 2
  • 29
  • 35