How to enable nginx debug logging?

enable-nginx-debug-logging

In this article we will explain how to enable Nginx debug logging .
To enable debugging in NGINX, you will need to compile/recompile Nginx with the “–with-debug” flag specified in the configure script.

Now compile nginx with “–with-debug” flag

Now we will see how to enable nginx debug logging

Writing Nginx Debugging Log to a File

The debugging log records errors and any debugging-related information and is disabled by default. To enable it, you will have to recompile nginx with

“–with-debug” flag.
Then add following line in the nginx configuration file /etc/nginx/nginx.conf

Locate the “error_log” directive and set the log level to debug

Restart Nginx once done.

Now you can check the log file “/var/log/nginx/error.log” using tail

Sample logs are below

SUMMARY

In this article we explained how to enable nginx debug logging on a Linux Machine.

As always,Please drop us a note if you have any questions or feedback using our comment form below . Always Happy to Help ????

Leave a Reply

Your email address will not be published. Required fields are marked *