502 Bad Gateway Nginx and I Don't Know Why

My LibreNMS instance was running great, but then the interface went off-line. Now, we just get a 502 Bad Gateway error. I feel like I’m chasing my tail at this point, trying to come up with the right answer from a bunch of different support forum posts that don’t quite match what’s going on with my server.

‘./validate.php’ results:
https://p.libren.ms/view/24b3bdac#L11

‘systemctl status’ results:
https://p.libren.ms/view/19e75ada

‘systemctl status php8.3-fpm’ results:
https://p.libren.ms/view/d48c9915

‘systemctl status nginx’ results:
https://p.libren.ms/view/838279dd

Querying the user on /run/php-fpm-librenms.sock:
srw-rw---- 1 librenms librenms 0 Feb 10 11:30 /run/php-fpm-librenms.sock

Errors in nginx.log:
https://p.libren.ms/view/26e2348c

And, I don’t know if I used the pastebin right. Sorry.

From what I was able to gather from other support forum posts, this is a permissions issue, but I don’t know why my librenms user would be unable to access the socket. I followed the installation instructions very closely, and like I said in my original post, my LibreNMS system was running great for about six months.

Double check over the following:

Thanks for jumping in.

I’ve reviewed the installation instructions, trying to locate the problem. My php-fpm configuration is correct including “listen = /run/php-fpm-librenms.sock” as my listen instructions in the librenms.conf file in my /etc/php/8.3/fpm/pool.d directory, and also the proper “librenms” settings in user, group, and pool. Also, my nginx config settings, in the /etc/nginx/conf.d/librenms.conf file, match the installation instructions. Additionally, the nginx config file matches the socket location (fastcgi_pass unix:/run/php-fpm-librenms.sock) that’s in the php-fpm “listen” line.

Ended up poking around and fixing this myself. The unix socket permissions section of the config file at /etc/php/8.3/fpm/pool.d/librenms.conf weren’t correct. Everything started working again once I rewrote that section to:
listen.owner = www-data
listen.group = www-data
listen.mode = 0660

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.