Error attempting to visit/manage my Wordpress sites: "502 Bad Gateway nginx/1.14.0 (Ubuntu)"

December 1, 2019 154 views
WordPress Nginx Ubuntu 16.04

Hello,

I noticed a couple days ago that my wordpress sites were returning this 502 Bad Gateway error (I hadn’t updated in at least several months), and after sifting through a lot of documentation, I don’t think I’m any closer to understanding what the problem is.

Steps I have taken so far:

  • upgraded php to 7.3
  • tried removing wordpress plugins
  • confirmed nginx is running ok
  • SSL cert renewal dry run shows OK
  • …plus a whole bunch of other trial/error stabs that didn’t help anything

FWIW I have noticed the Apache server fails to start, returning the error: “(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80” though I don’t know if this is even relevant.

I have a single droplet running two wordpress sites on two different domains. These have worked without any problems for at least a few years (migrated over from another hosting service). They are now both returning the same “502 bad gateway” error when I attempt to access them.

Any help would be greatly appreciated, either getting past the bad gateway error, or, if necessary, doing a fresh install of wordpress and my database without losing the existing information.

Thanks,
Lcx

1 Answer

In case it helps anyone with a similar problem, I’ve managed to resolve this issue. Error logs turned up a bad line in my nginx conf file relating to the php upgrade (from 5 to 7). The revisions to files found at “/etc/nginx/sites-enabled” as described here and in digitalocean documentation here resolved things for me.

by Brennen Bearnes
PHP 7.0 was released on December 3, 2015. It promises substantial speed improvements over previous versions of the language, along with new features like scalar type hinting. This guide explains how to quickly upgrade a PHP 5.x installation on an Ubuntu 14.04 system with Apache or Nginx, using community-provided packages.
Have another answer? Share your knowledge.