I have started to have a lot of hassle with 502 errors when trying to access wp-admin. I have found that clearing the browser cache and restarting it will get me in, once, but after that the 502 is back. I have also installed Opera as a test and that produced 502 at the first time of asking. The website itself loads perfectly every time.
I have read that 502’s can be caused by inter-server issues and wondered if Wordpress admin is served from a different server than the main website? This issue is new for me, nothing changed on the site.
Nope. wp-admin is completely served on the same thing that serves your main site.
502 errors often happens if there are too many plugins. (At least this is the case to me.) Too many plugins make the server load high, especially when some heavy plugins present. So please try removing unnecessary plugins.
You said that it doesn’t happen the first time you access the website. Still, please try removing some plugins.
The 502 Bad Gateway errors are usually caused by PHP code taking too long to execute (more than 60 seconds I think). Having too many or too heavy plugins can cause this to happen.
If the 502 errors are preventing you from being able to access wp-admin entirely to fix this issue, you can also disable plugins through FTP or through the database:
Ahha, the wp-admin workaround is very helpful, I was struggling with that.
It is true that if I do get wp-admin loaded, it is very slow to get to the login. The most recent plugin addition was analytics so I will start disabling one by one to find the culprit, beginning with analytics. Thank you.
So, the last plugin I had installed was Koko Analytics (which I like by the way), and so this is the first I de-activated. Suddenly the admin console was more responsive and so far no more 502s. Thanks Admin.