nginx – Munin via CGI – connect() to unix:/var/run/munin/fastcgi-html.sock failed
The Permission Denied was quite easy to find, taking a look at the socket. It belonged to www-data (as specified in spawn-fcgi), yet nginx was using a different user name, that is, nginx on my system.
spawn-fcgi -s /var/run/munin/fastcgi-graph.sock -U nginx -u munin -g munin /usr/lib/munin/cgi/munin-cgi-graph
spawn-fcgi -s /var/run/munin/fastcgi-html.sock -U nginx -u munin -g munin /usr/lib/munin/cgi/munin-cgi-html
That altered the error message into a “COnnection Refused”:
2025/01/20 20:47:22 [error] 695040#695040: *25715 connect() to unix:/var/run/munin/fastcgi-html.sock failed (111: Connection refused) while connecting to upstream, client: :2:4:3:2:1e, server: s2survey.net, request: "GET /munin/ HTTP/2.0", upstream: "fastcgi://unix:/var/run/munin/fastcgi-html.sock:", host: ".net"
This one was much harder to fix. The solution was to run the program that the socket connected to. It told me to use the munin user
sudo munin /usr/lib/munin/cgi/munin-cgi-html
The result then told me the trouble’s cause: It seems that a logfile had one been created with the wrong owner.
Status: 500 Content-type: text/htmlCan't open /var/log/munin/munin-cgi-html.log (Permission denied) at /usr/share/perl5/Log/Log4perl/Appender/File.pm line 151.This line then solved the problem:
chown munin:munin /var/log/munin/munin-cgi-html.logHope to save others from serious headaches.
Read more here: Source link
