Munin can render both graphs and HTML pages periodically (cron driven) or on-demand with CGI. The method can be configured in /etc/munin/munin.conf by setting graph_strategy and html_strategy to either cgi or html. So for a CGI driven setup you will want these lines:

graph_strategy cgi
html_strategy cgi

For CGI to work (including the zoomable graph), you need a CGI module for Apache, e.g.:

apt-get install libapache2-mod-fcgid

Apache 2.4 configuration snippets

Cron HTML and graphs, no zoomable graph

With the default configuration in the Debian package, a Cron job will generate HTML and PNG files under /var/cache/munin/www. You can point your browser at this directory and load the files directly from there.

To serve when using Apache, you only need to serve the static files under a path (excerpt of the standard /etc/munin/apache24.conf):

Alias /munin /var/cache/munin/www
<Directory /var/cache/munin/www>
        Require local
        Options None
</Directory>

CGI graphs

The zoomable graph requires enabling the CGI script. This is the config that is shipped with the munin package as /etc/munin/apache24.conf. There is a symlink to this file from /etc/apache2/conf-available, so you can enable it with

a2enconf munin

For reference, the Apache config looks like this:

Alias /munin /var/cache/munin/www
<Directory /var/cache/munin/www>
        Require local
        Options None
</Directory>

ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
<Location /munin-cgi/munin-cgi-graph>
        Require local
        <IfModule mod_fcgid.c>
            SetHandler fcgid-script
        </IfModule>
        <IfModule !mod_fcgid.c>
            SetHandler cgi-script
        </IfModule>
</Location>

The default graph_strategy is cron, so the CGI script is only used for the zoomable graph. With the above config, you can change graph_strategy to cron and avoid pre-generating the PNG images.

CGI HTML pages

To avoid pre-generating the HTML pages too, you need to set graph_strategy to cgi and change the Apache config slightly:

Alias /munin/static /var/cache/munin/www/static
<Directory /var/cache/munin/www/static>
        Require local
        Options None
</Directory>

ScriptAlias /munin /usr/lib/munin/cgi/munin-cgi-html
<LocationMatch "^/munin/(?!static/)">
        Require local
        <IfModule mod_fcgid.c>
            SetHandler fcgid-script
        </IfModule>
        <IfModule !mod_fcgid.c>
            SetHandler cgi-script
        </IfModule>
</LocationMatch>

ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
<Location /munin-cgi/munin-cgi-graph>
        Require local
        <IfModule mod_fcgid.c>
            SetHandler fcgid-script
        </IfModule>
        <IfModule !mod_fcgid.c>
            SetHandler cgi-script
        </IfModule>
</Location>

You can then go and delete the HTML and PNG files under /var/cache/munin/www/ since they're no longer used. The static/ directory there is copied from /etc/munin/static every time the Cron job runs.

Common Errors

Cannot serve directory /var/cache/munin/www/: No matching DirectoryIndex (index.php) found, and server-generated directory index forbidden by Options directive

If you get the following error:

[Tue Sep 20 21:20:13.517052 2016] [autoindex:error] [pid] [client ] xxx: Cannot serve directory /var/cache/munin/www/: No matching DirectoryIndex (index.php) found, and server-generated directory index forbidden by Options directive

Please add the ?DirectoryIndex index.html at the bottom of the <Direcoty> directive in /etc/munin/apache24.conf

<Directory /var/cache/munin/www>
        .....
        .....
        DirectoryIndex index.html
</Directory>