Debugging WordPress with Nginx


To debug a WordPress setup, you just need to add the line below in wp-config.php

define('WP_DEBUG', true);

Most likely, the line will be there by default. You just need to change the false flag to true.

Better WordPress debugging…

I am not a fan of the above method even though it is commonly preferred. This is because using WP_Debug outputs all error messages on screen. If you are working on Ajax-based application, debug output can mess your server-side response, and break your Ajax calls.

I will recommend using the lines below in wp-config.php

define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG', true);
define('SAVEQUERIES', true);

The first line will turn on debugging.

The second line will prevent errors from being displayed on the screen.

The third line generally logs errors in a /wp-content/debug.log file. You may not see this file on Nginx, so look out for Nginx’s error log file.  If you are following our WordPress-Nginx setup convention, then for domain, you can find logged errors in /var/www/

Otherwise, errors might be logged to Nginx’s default error log, mostly /var/log/nginx/error.log file.


Discuss your project
with our experts

No obligation. Limited slots.

Contact Form Business Enquiry

"*" indicates required fields

Please attach any RFP, project specification, or document that you would like to share.
Drop files here or
Max. file size: 5 GB.
    This field is for validation purposes and should be left unchanged.