nginx configuration¶
This example describes how to set up nginx for serving content generated by munin.
This document describes two alternative configurations:
- serving static graphs and HTML generated by munin-cron
- proxy traffic to munin-httpd
Serving cron-made graphs and HTML¶
Nginx is quite good at serving static files, and as such the configuration is mostly in place already.
The paths are as in use on a Debian Linux system. Add the following to /etc/nginx/sites-enabled/default:
location /munin/static/ {
alias /etc/munin/static/;
expires modified +1w;
}
location /munin/ {
auth_basic "Restricted";
# Create the htpasswd file with the htpasswd tool.
auth_basic_user_file /etc/nginx/htpasswd;
alias /var/cache/munin/www/;
expires modified +310s;
}
If this is a dedicated Munin server, you might want to redirect the front page as well:
location / {
rewrite ^/$ munin/ redirect; break;
}
Using munin-httpd¶
You can use nginx as a proxy in front of munin-httpd.
This enables you to add transport layer security and http authentication (not included in this example).
location /munin/static/ {
alias /etc/munin/static/;
}
location /munin/ {
proxy_pass http://localhost:4948/;
}