【问题标题】:Installing Munin on debian 6 and getting 403在 debian 6 上安装 Munin 并获得 403
【发布时间】:2013-04-18 04:41:22
【问题描述】:

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

我的配置如下:

  • node 和 master 安装在同一台服务器上。
  • 文件/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 中没有生成图表,因为这个文件夹是空的,而且没有生成日志,我不明白为什么。

【问题讨论】:

    标签: apache munin


    【解决方案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>
    

    最后,开始享受新版本的穆宁

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

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

    【讨论】:

    • 我在 Ubuntu 16.04 上使用了这个 vhost 配置来让 fast-cgi 工作,但它过于复杂。官方文档也提到了 munin-httpd,但这个 http 守护进程似乎没有出现在 16.04 中可用的版本 (2.0.25) 上。我宁愿使用 munin 提供的 http 守护进程,而不是这个疯狂的配置..
    猜你喜欢
    • 1970-01-01
    • 2013-06-10
    • 1970-01-01
    • 1970-01-01
    • 2016-09-19
    • 1970-01-01
    • 2013-11-03
    • 2021-12-19
    • 2014-06-12
    相关资源
    最近更新 更多