A 502 Bad Gateway error means your web server isn’t getting a valid response from the upstream server, usually PHP-FPM or the database. With WordPress, this can almost always be resolved by checking PHP-FPM, plugins, memory limits, and log files. In this article, you’ll find a clear step-by-step plan to get your site back online quickly and permanently identify the cause.
What is a 502 Bad Gateway error?
A 502 error occurs when your web server receives an invalid response from the server that is supposed to build the page. With WordPress hosting, this is usually caused by one of the following:
- PHP-FPM is not responding or has crashed
- The database is temporarily unreachable
- The memory limit (memory_limit) has been exceeded
- Timeout settings are too tight for a heavy task
- A plugin or theme is causing a conflict
A 502 error is different from a 503 error: 502 indicates a communication failure between server components, while 503 usually indicates overload or maintenance.
Quick fixes to try immediately
Before digging deeper, there are a few quick checks that often resolve the issue right away:
- Refresh the page after a few seconds; sometimes it’s a temporary traffic spike
- Clear the LiteSpeed cache via Plesk or your caching plugin
- Check whether PHP-FPM is active in Plesk under Service Management
- Check whether a plugin or theme has recently been updated
Step-by-step plan for a structural solution
Check PHP-FPM status
Log in to Plesk and go to Tools & Settings > Service Management. Make sure PHP-FPM is running; restart it if necessary and refresh your site after about thirty seconds.
Isolate plugins and theme
Using the file manager, rename the /wp-content/plugins/ folder to /wp-content/plugins-disabled/. Does the site work again? Then rename the plugins back one by one until you find the culprit.
Increase the memory limit
In Plesk, go to Domains > your-domain.com > PHP Settings and increase memory_limit to at least 256M. Larger sites often benefit from 512M.
Analyze the log files
Check the error_log and access_log under Domains > your-domain.com > Logs. Look for messages about PHP-FPM, connection refused, or timeout to find the exact cause.
Advanced troubleshooting
If the error keeps recurring, look into these deeper causes:
- Timeouts: increase max_execution_time to 300 seconds for heavy tasks such as imports or updates
- Database connection: check the login credentials in wp-config.php and test the connection via phpMyAdmin in Plesk
- Cron jobs: a stuck wp-cron job can repeatedly cause 502 errors; check scheduled tasks in WordPress
- Resources: if your site has grown, a hosting plan with more computing power may be needed
If you can’t resolve it yourself, contact us via the knowledge base and support, where you can also get help 24/7 via WhatsApp, ticket, or email. Also make sure your business email hosting and domain names remain unaffected by this issue, so visitors can always reach you.
Frequently Asked Questions
Is a 502 error the same as a 503 error?
No. 502 indicates a communication failure between server components, while 503 usually indicates overload or scheduled maintenance. The solution approach therefore differs.
Could my hosting plan be the cause?
Yes. Insufficient RAM or CPU can cause PHP processes to crash. If your site is growing, consider a larger plan with more resources.
Why does the error keep coming back?
Often due to an undetected plugin conflict, insufficient resources, or a stuck cron job. Check these points systematically.
Does reinstalling WordPress help?
Usually not, since the cause lies on the server side. This risks unnecessary data loss; it’s better to solve it step by step.
What if I recently switched hosting providers?
First check whether the DNS and database settings have been correctly transferred. When switching to a new provider, these settings are usually migrated automatically, but it’s good to verify this.
Conclusion
You can resolve a WordPress 502 Bad Gateway error by systematically checking PHP-FPM, plugins, memory limits, and log files. With the right steps, the error is usually fixed within a few minutes, and for structural problems, it helps to look at resources or plugin conflicts.