##
# Example configuration for munin using munin-cgi-html and
# munin-cgi-graph as FastCGI
#
# Put this file in /etc/nginx/sites-available and link it in
# /etc/nginx/sites-enabled
#
# In addition, the Munin log files and html area should be writable
# to the web server.
#
# Based on http://munin-monitoring.org/wiki/CgiHowto2#nginx
##

server {
	listen 127.0.0.1;

	root /var/cache/munin;

	access_log /var/log/nginx/munin-access.log;
	error_log /var/log/nginx/munin-errors.log;

	# Make site accessible from http://localhost/
	server_name localhost;

	location / {
		deny all;
	}

	location /munin/static/ {
		alias /etc/munin/static/;
		expires 31d;
	}

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

	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:/run/munin/fcgi-graph.sock;
		include fastcgi_params;
	}
}
