Munin + Apache: CGI problems

While setting up Munin on my new server I got an error when accessing its CGI HTML and graph endpoints:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

With Debian's own /etc/apache2/conf-available/munin.conf and mod_fcgi, the Apache log files showed:

[fcgid:warn] [pid 604137:tid 604188] (104)Connection reset by peer: [client 2a00::1:37614] mod_fcgid: error reading data from FastCGI server
[core:error] [pid 604137:tid 604188] [client 2a00::1:37614] End of script output before headers: munin-cgi-html

When switching to proxy access as described on the Debian Munin wiki page, I got this:

[proxy:error] [pid 615310:tid 615315] (111)Connection refused: AH02454: FCGI: attempt to connect to Unix domain socket /run/munin/fcgi-html.sock (127.0.0.1:8000) failed
[proxy_fcgi:error] [pid 615310:tid 615315] [client 2a00::1:47122] AH01079: failed to make connection to backend: 127.0.0.1

In the end the problem was that both munin-graph and munin-html services failed to start:

$ systemctl status munin-graph
× munin-graph.service - Munin FastCGI Graph
     Loaded: loaded (/etc/systemd/system/munin-graph.service; static)
     Active: failed (Result: exit-code) since Sun 2025-12-28 13:51:00 CET; 5h 50min ago
   Duration: 123ms
 Invocation: 6d15c12984364418a0b8b996dc5fc072
TriggeredBy: ● munin-graph.socket
    Process: 588072 ExecStart=/usr/lib/munin/cgi/munin-cgi-graph (code=exited, status=13)
   Main PID: 588072 (code=exited, status=13)
   Mem peak: 17.5M
        CPU: 103ms
 
Dez 28 13:51:00 ahso5 systemd[1]: Started munin-graph.service - Munin FastCGI Graph.
Dez 28 13:51:00 ahso5 munin-cgi-graph[588072]: [Sun Dec 28 13:51:00 2025] munin-cgi-graph: Can't open /var/log/munin/munin-cgi-graph.log (Permission denied) at /usr/share/perl5>
Dez 28 13:51:00 ahso5 munin-cgi-graph[588072]: Unable to flush stdout: Der Socket ist nicht verbunden
Dez 28 13:51:00 ahso5 systemd[1]: munin-graph.service: Main process exited, code=exited, status=13/n/a
Dez 28 13:51:00 ahso5 systemd[1]: munin-graph.service: Failed with result 'exit-code'.

The log file was owned by www-data, although the systemd services are running as munin user. Changing the ownership solved the problem:

$ chown munin /var/log/munin/munin-cgi-*
$ systemctl restart munin-graph
$ systemctl restart munin-html

Written by Christian Weiske.

Comments? Please send an e-mail.