Tag wp_die

Read about the posts of tag wp_die

How to fix ISPConfig + NGINX + WordPress = ERROR 500?

A few months ago, one of my servers with WordPress, made error 500, each time a user made an action.

After searching unsuccessfully in Google and various forums, I began to debug the situation, beginning to see what was going on with WordPress and to find out what was the source of the problem.

 

Problem

We installed a server with Nginx, all of our servers use Nginx, working perfectly with a lot of sites configured. A customer asked us to install WordPress. Normal situation. But a few days later, the client called us because sometimes appears a yellow screen with a 500 message error.

 

ispconfig-wordpress-error500

We decided to investigate a little bit, debugging WordPress, and we detected that happen.  WordPress, sometimes, runs a line with the instruction wp_die(). Isn’t normal termination, but sometimes, execution finish with this instruction.

This function sends a message to the user, but also add a 500 error in the packet header returned to the browser. This is normal behaviour, but the browser, instead of showing a message are showing an ISPConfig error 500 pages.

Here, we decide to investigate nginx. And why is sending the yellow 500 error page?

Explanation

After a lot of time and config files, finally, I found that the site has special config lines in the Nginx configuration file. Let’s see, the configuration:

And, other lines similar:

These instructions force nginx to send the page with Error 500.

Solution

If you see the config file, you will notice that have files called with numbers inside the errors folder. I don’t put the files there, so, ISPConfig put files there.

Then, the solution is so simple that … whatever!

ISPConfig has an option in the sites’ configuration called Own Error-Documents:

ispconfig-web-domain-error500

 

So, to run WordPress must be unchecked the option Own Error-Documents.

When you uncheck this option, ISPConfig deletes the code of the nginx configuration and the errors folder.
So WordPress runs perfectly now, sending messages to the browser.