502 Bad Gateway when upgrading or installing wp sites with PHP 7


I’m on Ubuntu 16.04.6 LTS and I’m attempting to upgrade my WP sites to PHP 7 (currently PHP 5.6).

PHP 7 appears to be running:

root@XXXX:~# ee stack status
nginx     :  Running
php5.6-fpm:  Running
php7.0-fpm:  Running
mysql     :  Running
postfix   :  Running

But if I either create a new site or attempt to update an existing one to PHP 7 I just get a 502 Bad Gateway error and the following in my error.log:

2019/09/12 10:24:10 [error] 15211#0: *39155 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xx, server: site.com, request: "GET / HTTP/1.1", upstream: "fastcgi://", host: "site.com".

If I switch off PHP 7 the sites load as expected.

I’ve been through all my nginx conf files (though there are a lot so I might have missed something) and can’t seem to find anything that needs changing.

Any ideas anyone?

1 Like

I have the same issue.

I installed the websites with HVVM in the past. Turning it off ( ee site update mysite.com --hvvm=off breaks the site).
I rebooted afterwards in the hope that it would work, but it doesnt.

It’s not using php7 also, but PHP Version 5.6.30-7+deb.sury.org~xenial+1

I thought i updated to php7 in the past, but it doesn’t seem to be the case :frowning:

PS. You can see the info with "ee site info mysite.com "

1 Like