Debian 11、Nagios4 和 403 被禁止

Debian 11、Nagios4 和 403 被禁止

安装了 Debian 的 Nagios4 包后,我无法访问它。Apache 给了我以下信息:

AH01797: client denied by server configuration: /usr/share/nagios4/htdocs

我尝试了各种各样的方法,比如将相关目录的所有权更改为 www-data 用户和组(apache2 以此用户身份运行),以及编辑配置文件以添加该目录的权限:

/etc/apache2/conf-available/nagios4-cgi.conf

...
<Directory /usr/share/nagios4/htdocs>
    Options     +ExecCGI        
    Order allow,deny
    Require all granted
</Directory>
...

/etc/apache2/sites-enabled/

ScriptAlias /cgi-bin/nagios4 /usr/lib/cgi-bin/nagios4
ScriptAlias /nagios4/cgi-bin /usr/lib/cgi-bin/nagios4
Alias /nagios4/stylesheets /etc/nagios4/stylesheets
Alias /nagios4 /usr/share/nagios4/htdocs
<DirectoryMatch (/usr/share/nagios4/htdocs|/usr/lib/cgi-bin/nagios4|/etc/nagios4/stylesheets)>
    Options FollowSymLinks
    DirectoryIndex index.php index.html
    AllowOverride AuthConfig
    #Require ip ::1/128 fc00::/7 fe80::/10 10.0.0.0/8 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16
    <Files "cmd.cgi">
        AuthDigestDomain "Nagios4"
        AuthDigestProvider file
        AuthUserFile    "/etc/nagios4/htdigest.users"
        AuthGroupFile   "/etc/group"
        AuthName        "Nagios4"
        AuthType        Digest
        Require all     granted
    </Files>
</DirectoryMatch>
<Directory /usr/share/nagios4/htdocs>
    Options     +ExecCGI        
    Order allow,deny
    AllowOverride All
    Require all granted
</Directory>

有人能想到我遗漏了什么吗?

答案1

最终的答案是将指令从 Directory 块移到 DirectoryMatch 块,特别是Require all granted

相关内容