在debian 6上安装Munin并获得403

时间:2013-03-26 13:39:49

标签: apache munin

我在我的服务器上安装了Munin,但是当我尝试访问mypage.com/munin时,我收到403错误:禁止,您无权访问/ munin /在此服务器上。

我的配置如下:

  • 节点和主服务器安装在同一服务器上。
  • 文件/etc/munin/apache.conf具有以下配置

     Alias /munin /var/cache/munin/www
     <Directory /var/cache/munin/www>
        Order allow,deny
        Allow from all
        Options FollowSymLinks SymLinksIfOwnerMatch
        <IfModule mod_expires.c>
           ExpiresActive On
           ExpiresDefault M310
        </IfModule>
    </Directory>
    
  • munin conf是/etc/munin/munin.conf

    dbdir   /var/lib/munin
    htmldir /var/cache/munin/www
    logdir /var/log/munin
    rundir  /var/run/munin
    ....
    [myserver]
        address 127.0.0.1
        use_node_name yes
    
  • ,而节点配置(/etc/munin/munin-node.conf)是默认配置。

在/ var / cache / munin / www文件夹中没有生成图表,因为这个文件夹是空的,但是也没有生成日志,我也不明白为什么。

1 个答案:

答案 0 :(得分:1)

使用新版本的Munin 2.0!

创建并编辑/etc/apt/sources.list.d/backports.list并添加:

deb http://backports.debian.org/debian-backports squeeze-backports main

更新存储库,然后安装munin

# apt-get update
# apt-get install munin -t squeeze-backports

此版本的Munin默认使用CGI生成HTML和GRAPH。因此,请务必在配置虚拟主机之前执行此操作:

# apt-get install libapache2-mod-fcgid
# a2enmod fcgid

配置您的虚拟主机:

    <VirtualHost *:80>
        DocumentRoot /var/cache/munin/www
        ServerName munin.example.com
        Alias /static /etc/munin/static
        # Rewrites
        RewriteEngine On
        # HTML
        RewriteCond %{REQUEST_URI} !^/static
        RewriteCond %{REQUEST_URI} .html$ [or]
        RewriteCond %{REQUEST_URI} =/
        RewriteRule ^/(.*)           /usr/lib/munin/cgi/munin-cgi-html/$1 [L]
        # Images
        # - remove path to munin-cgi-graph, if present
        RewriteRule ^/munin-cgi/munin-cgi-graph/(.*) /$1
        RewriteCond %{REQUEST_URI}                 !^/static
        RewriteCond %{REQUEST_URI}                 .png$
        RewriteRule ^/(.*)  /usr/lib/munin/cgi/munin-cgi-graph/$1 [L]
        # Ensure we can run (fast)cgi scripts
        ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
        <Location /munin-cgi/munin-cgi-graph>
                Options +ExecCGI
                <IfModule mod_fcgid.c>
                        SetHandler fcgid-script
                </IfModule>
                <IfModule !mod_fcgid.c>
                        SetHandler cgi-script
                </IfModule>
                Allow from all
        </Location>
        ScriptAlias /munin-cgi/munin-cgi-html /usr/lib/munin/cgi/munin-cgi-html
        <Location /munin-cgi/munin-cgi-html>
                Options +ExecCGI
                <IfModule mod_fcgid.c>
                        SetHandler fcgid-script
                </IfModule>
                <IfModule !mod_fcgid.c>
                        SetHandler cgi-script
                </IfModule>
                Allow from all
        </Location>
        <Location />
                Options +ExecCGI
                <IfModule mod_fcgid.c>
                        SetHandler fcgid-script
                </IfModule>
                <IfModule !mod_fcgid.c>
                        SetHandler cgi-script
                </IfModule>
                Allow from all
        </Location>
        <Location /static/>
                SetHandler None
                Allow from all
        </Location>
        <Directory /var/cache/munin/www>
                Order allow,deny
                #Allow from localhost 127.0.0.0/8 ::1
                Allow from all
                Options None
                # Set the default expiration time for files to 5 minutes 10 seconds from
                # their creation (modification) time.  There are probably new files by
                # that time.
                #
            <IfModule mod_expires.c>
                ExpiresActive On
                ExpiresDefault M310
            </IfModule>
        </Directory>
</VirtualHost>

最后,开始享受Munin的新版本

# a2ensite munin
# /etc/init.d/apache2 reload

现在,您可以在几分钟后访问http://munin.example.com中的munin。让munin先收集一些数据。