WordPress random 500 internal server error

Solution:1

I wanted to add this as comment, but unfortunately I don’t have enough points.

This can be because of some plugin messing with HTTP headers – have you installed some plugin/theme soon before the errors start showing?

Can you enable WP_DEBUG, to see if you can catch something there, as sometimes it is more useful than the server logs.

To do this, open

wp-config.php

located in the directory where WordPress is installed and then locate the line with the code

define('WP_DEBUG', false);

and change it to

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

That will save the log in a file called debug.log and located in your wp-content directory. It is important step to set it log to a file, if you don’t want to have errors thrown on the site.

You can also refer to this codex page.

Solution:2

Considering your comment below (mysql server has gone away) and the random 500 (apache/http) internal server error, the server could possibly be under a heavy load. It may be receiving more connections than it can handle until either apache or mysql are unable to respond. I would check with the web hosting provider to verify if the issue is related to the server or your site specifically.

I’ve run into plugins with memory leaks and all kinds of issues. If it is indeed something with your site, I would try disabling all plugins to see if this resolves the issue, then re-enable them one at a time trying to reproduce the issue.

So then, if you do narrow it down to one plugin – check for (and install) updates (after taking a backup), seek support from the plugin author, seek an alternate plugin, hire a developer, or simply go without it.