Munin Virtual Host Configuration on Ubuntu 14.04 and Apache 2.4

09
Jul
2014

Munin Virtual Host Configuration on Ubuntu 14.04 and Apache 2.4

Having switched to Nginx a while ago, I was recently forced to use Apache for a client installation. There have been some significant changes in 2.4 from 2.2, include the 'Requires' option.  I also wanted to create a virtualhost entry for Munin on this machine. It took a little while to figure this out, in particular on Apache 2.4. I'm also using the built-in cron task to generate graphs. Here's the complete Virtualhost configuration for Munin on Ubuntu 14.04 and Apache 2.4

 

<VirtualHost *:80>
    ServerName munin.yourhost.com
    ServerAlias munin
    ServerAdmin  yours@email.com
    DocumentRoot "/var/cache/munin/www"
    DirectoryIndex index.html 
 
    <Directory "/var/cache/munin/www">
        AuthUserFile /etc/apache/htpasswords
        AuthName "admin"
        AuthType Basic
        require valid-user
    </Directory>
 
 
    ErrorLog  /var/log/apache2/munin.yourhost.com-error.log
    CustomLog /var/log/apache2/munin.yourhost.com-access.log combined
 
    # Rewrites
    RewriteEngine On
 
    # Static content in /static
    RewriteRule ^/favicon.ico /etc/munin/static/favicon.ico [L]
    RewriteRule ^/static/(.*) /etc/munin/static/$1          [L]
 
    # HTML - Uncomment for CGI graphs
    #RewriteCond %{REQUEST_URI} .html$ [or]
    #RewriteCond %{REQUEST_URI} =/
    #RewriteRule ^/(.*)          /usr/lib/munin/cgi/munin-cgi-html/$1 [L]
 
    # Images
    #RewriteRule ^/(.*) /usr/lib/munin/cgi/munin-cgi-graph/$1 [L]
 
    <Directory "/etc/munin/static">
        Require all granted
    </Directory>
 
    # Ensure we can run (fast)cgi scripts
    <Directory "/usr/lib/munin/cgi">
        Options +ExecCGI
        Require all granted
        <IfModule mod_fcgid.c>
            SetHandler fcgid-script
        </IfModule>
        <IfModule !mod_fcgid.c>
            SetHandler cgi-script
        </IfModule>
    </Directory>
</VirtualHost>
Category: