502 Bad Gateway

Status
Not open for further replies.

mc6650

Member
Apr 8, 2019
109
2
18
61
Hello
I recently upgraded my FusionPBX from Debian 10 to Debian 11. When I try to access the admin panel via a browser and the IP address, I receive a "502 Bad Gateway" "nginx/1.18.0" error message. The phones are logged into the switch and can make calls plus I can SSH into the system. How do I correct this error so I can successfully log back into the admin panel?

Thanks in advance for any help that can be provided.
 

mc6650

Member
Apr 8, 2019
109
2
18
61
Hello
I've done some further digging around and found this in a nginx error.log file. Can you please recommend dwhat my next steps might be?

sudo cat /var/log/nginx/error.log
[sudo] password for pbx2:
2022/03/17 08:37:03 [crit] 720#720: *17 connect() to unix:/var/run/php/php7.3-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.2.52, server: fusionpbx, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "192.168.2.25"
2022/03/17 08:37:03 [error] 720#720: *17 open() "/var/www/fusionpbx/favicon.ico" failed (2: No such file or directory), client: 192.168.2.52, server: fusionpbx, request: "GET /favicon.ico HTTP/1.1", host: "192.168.2.25", referrer: "https://192.168.2.25/"
2022/03/17 08:40:28 [crit] 720#720: *19 connect() to unix:/var/run/php/php7.3-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.2.25, server: fusionpbx, request: "GET /core/user_settings/user_dashboard.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "192.168.2.25"
2022/03/17 08:40:29 [error] 720#720: *19 open() "/var/www/fusionpbx/favicon.ico" failed (2: No such file or directory), client: 192.168.2.25, server: fusionpbx, request: "GET /favicon.ico HTTP/1.1", host: "192.168.2.25", referrer: "https://192.168.2.25/core/user_settings/user_dashboard.php"
2022/03/17 08:42:43 [crit] 720#720: *21 connect() to unix:/var/run/php/php7.3-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.2.25, server: fusionpbx, request: "GET /login.php?path=%2Fcore%2Fdomains%2Fdomains.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "192.168.2.25"
2022/03/17 08:59:24 [warn] 585#585: the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/sites-enabled/fusionpbx:181
2022/03/17 08:59:37 [warn] 716#716: the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/sites-enabled/fusionpbx:181
2022/03/17 09:02:57 [crit] 718#718: *1 connect() to unix:/var/run/php/php7.3-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.2.25, server: fusionpbx, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "192.168.2.25"
2022/03/17 09:08:09 [warn] 580#580: the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/sites-enabled/fusionpbx:181
2022/03/17 09:08:26 [warn] 717#717: the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/sites-enabled/fusionpbx:181
2022/03/17 09:19:53 [crit] 720#720: *3 connect() to unix:/var/run/php/php7.3-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.2.52, server: fusionpbx, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "192.168.2.25"
2022/03/17 09:19:53 [error] 720#720: *3 open() "/var/www/fusionpbx/favicon.ico" failed (2: No such file or directory), client: 192.168.2.52, server: fusionpbx, request: "GET /favicon.ico HTTP/1.1", host: "192.168.2.25", referrer: "https://192.168.2.25/"

There doesn't seem to be a php7.3-fpm
/var/run$ ls
agentx dmeventd-client log plymouth tmpfiles.d
alsa dmeventd-server lvm postgresql udev
atd.pid exim4 memcached sendsigs.omit.d udisks2
avahi-daemon fail2ban motd.d shm user
blkid freeswitch motd.dynamic snmpd.pid utmp
console-setup gdm3 mount speech-dispatcher uuidd
credentials gdm3.pid network sshd xrdp
crond.pid initctl NetworkManager sshd.pid xtables.lock
crond.reboot initramfs nginx.pid sudo
dbus lock ntpd.pid systemd



I tried to restart the php service, but i won't start because it doesn't exist?

pbx2@fusionpbx:~$ sudo service php7.3-fpm restart
Failed to restart php7.3-fpm.service: Unit php7.3-fpm.service is masked.

And there isn't a "favicon.ico file

pbx2@fusionpbx:/var/www/fusionpbx$ ls
app index.php logout.php readme.md robots.txt secure
core login.php project_root.php resources root.php themes


I believe that nginx is running

systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset:>
Active: active (running) since Thu 2022-03-17 09:08:26 EDT; 52min ago
Docs: man:nginx(8)
Process: 580 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_proces>
Process: 717 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (co>
Main PID: 718 (nginx)
Tasks: 3 (limit: 6840)
Memory: 12.7M
CPU: 175ms
CGroup: /system.slice/nginx.service
├─718 nginx: master process /usr/sbin/nginx -g daemon on; master_p>
├─719 nginx: worker process
└─720 nginx: worker process

Warning: some journal files were not opened due to insufficient permissions.
 
Last edited:

mc6650

Member
Apr 8, 2019
109
2
18
61
Hello
Can someone point me in the right direction so I can get the admin panel back? I've installed php 7.4 with no improvement. I do have a backup from yesterday that was done when the machine was Debian 10.

Thanks
 

ad5ou

Active Member
Jun 12, 2018
884
195
43
For the first errors, it looks like you lost your php7.3 in the upgrade. You either need to reinstall 7.3 or update your nginx config to use the php version installed.
Check /etc/nginx/sites-enabeled/fusionpbx config file for the line starting with " location ~ \.php$ {" edit or replace any lines referencing php7.3-fpm with the currently installed php version. presumably 7.4
Then reload/restart nginx and see what happens.
 

mc6650

Member
Apr 8, 2019
109
2
18
61
Hello

Thanks for the suggestion.

I've go into the /etc/nginx/sites-enabeled/fusionpbx config file and replaced any reference to 7.3 with 7.4. Now I get a "error: could not find driver". Interestingly when I try and do a "sudo apt update" from the terminal I see:

Hit:1 http://deb.debian.org/debian bullseye InRelease
Hit:2 http://security.debian.org/debian-security bullseye-security InRelease
Hit:4 http://deb.debian.org/debian bullseye-updates InRelease
Hit:5 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg InRelease
Err:3 https://files.freeswitch.org/repo/deb/debian-release bullseye InRelease
401 Unauthorized [IP: 190.102.98.174 443]
Reading package lists... Done
E: Failed to fetch http://files.freeswitch.org/repo/deb/debian-release/dists/bullseye/InRelease 401 Unauthorized [IP: 190.102.98.174 443]
E: The repository 'http://files.freeswitch.org/repo/deb/debian-release bullseye InRelease' is no longer signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
 

mc6650

Member
Apr 8, 2019
109
2
18
61
Hello
Would someone know how I can resolve the two issues I'm having:

1.) in the browser I'm getting an "error: could not find driver"
2.) The "apt update" error messages

Thanks
 
Status
Not open for further replies.