502 Bad Gateway

Status
Not open for further replies.

ewdpb

Member
Oct 3, 2019
151
19
18
Hi all,

We are running latest version of FusionPBX. It was all sunny until two hours ago. Al of the sudden we started getting 502 Bad Gateway when trying to access the Web GUI. Freespeech itself is running and taking calls. We checked PHP, and NGNIX services, they are both up. We restarted everything just for the sake of but same results. NGNIX access logs show the following:

2019/10/20 22:54:19 [error] 2398#2398: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 245.150.2.28, server: fusionpbx, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "myfusion.mydomain.com"
2019/10/20 22:54:19 [error] 2398#2398: *1 open() "/var/www/fusionpbx/favicon.ico" failed (2: No such file or directory), client: 245.150.2.28, server: fusionpbx, request: "GET /favicon.ico HTTP/1.1", host: "myfusion.mydomain.com"
2019/10/20 22:57:29 [error] 2398#2398: *3 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 245.150.2.28, server: fusionpbx, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "myfusion.mydomain.com"


It says it cannot find favicon.ico and, in fact, that file is not there. Since we are not simply getting a regular 404, our guess is that something else is just down and that .ico file (and probably some other, more useful, files) is created at some point when that something else actually works.

We found this thread: https://www.pbxforums.com/threads/nginx-502-bad-gateway.799/ where @Len mentions it was a fail2ban issue. We tried simply stopping fail2ban but we do not see any diference. There is also this reference: https://www.bytesolutions.com/fusionpbx-error-502-bad-gateway/ However, it seems that it is a much older version, the nobody user I do not think is used anymore.

As always, any word of advice is welcome.

Best regards,

Wilmar

PD: I also followed the advice on this https://jvdc.me/fix-502-bad-gateway-error-on-nginx-server-after-upgrading-php/ (the second suggestion). It seems everything is already as it should be.
 
Last edited:

KonradSC

Active Member
Mar 10, 2017
166
99
28
I always fix a 502 Bad Gateway with:
systemctl restart php7.3-fpm

Something in the web interface is probably hung or taking a really long time to run. It's php though, not nginx.

If you have been manipulating files it's always good to issue "chown -R www-data:www-data /var/www/fusionpbx"
 

ewdpb

Member
Oct 3, 2019
151
19
18
Hi @KonradSC.

Thanks for your reply. I did restart php-fpm (and everythig else, including a box reboot). After a while I just got frustrated with the thing and recovered from a snapshot :).
 
Status
Not open for further replies.