502 Bad Gateway - NGINX

Just ran the following commands…

sudo apt-get update


sudo apt-get upgrade

…which produced the following list of items to upgrade:

The following packages will be upgraded:
  libgssapi-krb5-2 libk5crypto3 libkrb5-3 libkrb5support0 libperconaserverclient18.1 libxml2 ntp percona-server-client-5.6 percona-server-common-5.6 percona-server-server-5.6 php5-cli php5-common php5-curl php5-fpm php5-gd php5-geoip
  php5-imap php5-mcrypt php5-memcache php5-mysqlnd php5-readline php5-xdebug php5-xmlrpc tzdata
24 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 50.0 MB of archives.
After this operation, 2,202 kB of additional disk space will be used.
Do you want to continue [Y/n]?

I selected “Y” to continue.

During the installation process, I was presented with the following:

Configuration file `/etc/php5/fpm/pool.d/www.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** www.conf (Y/I/N/O/D/Z) [default=N] ?

Again, here I selected “Y”

When all the upgrade process finished, I now get the “502 Bad Gateway” error for the http://wetakeitlive.com website, which was working prior to these upgrades.


While the update process was simple and seemed pretty straight forward, it caused a critical functionality issue with the only WordPress website, on that server, when it modified the following file:


Unfortunately this makes me wonder if there were other changes I’m not yet aware of. I can tell you for sure that the following line:

listen = /var/run/php5-fpm.sock

…should read:

listen =

…so, I modified the file using:

sudo pico /etc/php5/fpm/pool.d/www.conf

…and the functionality of the website in question returned to normal.

Would anyone like to venture a guess at other issues, these updates may have caused?


You should select N when it was asked to update www.conf file. updating that file would remove changes easyengine made to that file.

To solve this issue you should purge php ee stack purge php and install again ee stack install php

I’m going to add this, as a point of interest for the original “502 Bad Gateway” error, topic/title, in case others find their way here, via search.

There is a problem with the EasyEngine installation process, which causes the “502 Bad Gateway” error to appear. I can easily replicate the problem, on my servers, but most importantly, I have identified a solution. Please take a look at the conversation thread found at: How to troubleshoot overloading server?

Hi @bamajr

I hope your query is resolved. I am closing this support topic for now.

Feel free to create a new support topic if you have any queries further. :slight_smile: