Enable debug log for Nginx
Sometimes, you need to enable the debug log feature on Nginx for troubleshooting some nasty issues.
Firstly, you need to make sure you have configured nginx to build with the debugging feature enabled
# ./configure --with-debug ...
If you are using the installing using apt-get on Ubuntu, you are ready to go by setting the following in the Nginx config:
... error_log /path/to/log debug; ...
Don't forget to restart the Nginx to take effect.