Table of Contents
Table of Contents
A 502 bad gateway error is triggered when your WordPress hosting server gets an invalid response for the requested page.
Bad gateway error is one of the common WordPress errors that you may encounter on your site. There are several possible causes, and the error message may also look slightly different depending on your server.
The most common reason for a 502 bad gateway error is when your request takes too long for the server to respond. The interruption can be a brief hiccup brought on by heavy traffic. Another possibility is a bug brought on by a badly written WordPress theme or plugin. As well as , a server configuration error may possibly be the cause.
This error is usually caused when your server is unable to find the cause of the invalid response.
Ready, let’s get started.
Because of high traffic or inadequate server resources, your server may occasionally take longer to respond. In that scenario, the issue might resolve itself in a matter of minutes. To determine whether this was the cause, it is helpful to try reloading the page you are currently reading.
Their servers can be malfunctioning if your website is protected by a website firewall or CDN provider. Try temporarily disable CDN
The extra layer that has been put in between your browser and the hosting server will be eliminated once it is disabled. Your website will now load entirely from your server and if the issue was caused by the CDN / firewall service, then it will get resolved now.
After that, you can get help from your CDN service provider.You can proceed to re-enable the CDN after the problem has been fixed.
Check theme or plugins.
Deactivate FTP every WordPress plugin using FTP. Check to check if the error has been fixed by going to your website after that.
If so, the problem was being caused by one of your plugins. In order to replicate the mistake, you must now activate each plugin individually.
You can fix this error by adding fastcgi_buffers in nginx configuration. For this,
nano /etc/nginx/sites-enabled/domain.conf
Add below lines in the nginx configuration under line location PHP.
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
If it didn’t resolve, also try adding these lines.
proxy_read_timeout 3600;
proxy_send_timeout 3600;
When PHP reaches the allowed maximum time in server configuration to execute a script, it shows an error. Occasionally, it may result in a 502 Bad Gateway error for WordPress. Just raise the maximum execution time value to get around this. By default, it is set to 300 seconds, which is 5 minutes.
Now you have read this article and know why and how bad gateway errors occur in WordPress sites, so you can troubleshoot them quickly. Whenever you see a “Bad gateway 502″ on your WordPress site, it is easy to sense that something went wrong with your website. Having the right knowledge about bad gateway errors can save a lot of time troubleshooting. You don’t have to wait for someone else to fix your problem if you already know what the problem is.
Visit Flexicloud to discover more about our comprehensive plans and diverse features, designed to meet all your cloud computing needs