1

I have a nginx to host a django application. I need to log 400 Bad Request errors from my web page to a separate log file in nginx configuration.

The docs I found was to give separate response in case of errors. I tried the following code with nginx configuration:

error_page 400 /400.html;

location /400.html {
    internal;
}

But the above code does not log the 400 errors.

2
1

In your snipet missing definiton of error log.

error_page 400 /400.html;

location /400.html {
    internal;
    error_log logs/400.log error;
}

In case you need documentation http://nginx.org/en/docs/ngx_core_module.html#error_log

1
  • but its not logging the 400 errors..  – Nijo May 24 '16 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.