Running an nginx server, and installed munin to monitor a few services on other machines. I am following these docs for installing munin cgi on nginx: https://guide.munin-monitoring.org/en/stable-2.0/example/webserver/nginx.html#webserver-configuration

This all seems fine, but when accessing serverip/munin or serverip/munin/static, I receive a 502 bad gateway. The logs show:

020/06/25 16:28:36 [crit] 10503#0: *1 connect() to unix:/var/run/munin/fastcgi-html.sock failed (13: Permission denied) while connecting to upstream, client:, server: grid, request: "GET /munin/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/munin/fastcgi-html.sock:", host: ""

However, /var/run/munin/fastcgi-*.sock is owner nginx and group nginx.

Relevant nginx configuration is as follows:

    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/fastcgi-graph.sock;
            include fastcgi_params;

    location /munin/static/ {
            alias /etc/munin/static/;

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

Normally when Nginx reports a permissions issue, it is fairly clear, but here I fail to see where the permissions are wrong.

 ls -l /var/run/munin
total 4
srw-r----- 1 nginx nginx 0 Jun 25 16:28 fastcgi-graph.sock
srw-r----- 1 nginx nginx 0 Jun 25 16:27 fastcgi-html.sock
-rw-r--r-- 1 munin munin 4 Jun 25 15:25 munin-html.lock

Any ideas would be greatly appreciated. I am running another munin node monitoring several boxes, but that setup is apache. This setup is nginx due to some other configurations.

  • check /etc/nginx/nginx.conf some packages have a different default user like user www-data;. Running ps aux | grep nginx will show you the owner of the worker instances accordingly. In this case you'd need to set the user to nginx.
    – Michael D.
    Jun 25, 2020 at 21:58
  • @MichaelD. yes, in nginx.conf it is user nginx nginx; ps aux |grep nginx shows the same. Thanks.
    – number9
    Jun 25, 2020 at 22:08
  • what's the permission/user for directory munin in /var/run/ ?
    – Michael D.
    Jun 25, 2020 at 22:09
  • @MichaelD.drwx------ 2 munin munin 100 Jun 25 17:15 munin
    – number9
    Jun 25, 2020 at 22:17

1 Answer 1


Change permission for /var/run/munin to allow nginx accessing the sock files.

chmod 750 /var/run/munin
chgrp nginx /var/run/munin

#restart nginx

systemctl restart nginx
  • What is really strange is that I could have sworn that I tried this, but I just did it again and it worked.
    – number9
    Jun 25, 2020 at 23:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .