Working zoom on munin graphs on Debian 11 with nginx

In nginx config:

server {
    # some server ...

    location /munin/static/ {
        alias /etc/munin/static/;
        expires modified +1w;
    }

    location /munin/ {
        alias /var/cache/munin/www/;
        expires modified +310s;
    }

    location ^~ /munin-cgi/munin-cgi-graph/ {
        fastcgi_split_path_info ^(/munin-cgi/munin-cgi-graph)(.*);
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_pass unix:/var/run/munin/fcgi-graph.sock;
        include fastcgi_params;
    }
}

Install required stuff (besides munin itself, ofc):

# apt install -y spawn-fcgi libcgi-fast-perl

Write systemd service (/etc/systemd/system/munin-fcgi.service):

[Unit]
Description=cgi graph for munin
After=network.target

[Service]
Type=forking
StandardOutput=null
StandardError=syslog
ExecStart=/usr/bin/spawn-fcgi -s /var/run/munin/fcgi-graph.sock -U www-data -u www-data -g www-data /usr/lib/munin/cgi/munin-cgi-graph

[Install]
WantedBy=multi-user.target

Enable and start the service:

# systemctl enable munin-fcgi
# systemctl start munin-fcgi

Should work now.

If you have any comments, contact me by email.