How Do You Capture More Events in the Nginx Logs?

Problem scenario
You want more verbose log capturing in Nginx. What should you do?

Solution
1. Make a back up of nginx.conf. Then open it. It is often in /etc/nginx/nginx.conf. (Some versions of nginx have a file that does some of the same things called default.conf. This will be the file you will need if you have no nginx.conf file.)

2. Find this stanza:

error_log /var/log/nginx/error.log;

Change it to be like this:

error_log /var/log/nginx/error.log debug;

3. Restart nginx. The error.log will have much more information. If you stop the Nginx service, this will be logged in error.log. You will also see malloc calls (memory allocation calls) and other vestiges of the C language. (Nginx was written in C.) This information can help you troubleshoot.

Leave a comment

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