CentOS 安装 MRTG 软件完成后的 403 Forbidden(转载)

用 yum 安装 MRTG 並设定好之后也把 apache 的 httpd.conf 加上 mrtg 的目录,但 http://server/mrtg 卻一直出現 403 Forbidden。
在 httpd.conf 怎麼看都找不出哪裡有問題,後來才發現套件會自動在 /etc/httpd/conf.d/下安裝 mrtg.conf。(這雖然這個的確很貼心)

#
# This configuration file maps the mrtg output (generated daily)
# into the URL space. By default these results are only accessible
# from the local host.
#
Alias /mrtg /var/www/html/mrtg

<Location /mrtg>
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
# Allow from .example.com
</Location>

修改mrtg.conf 为

Alias /mrtg /var/www/html/mrtg

<Location /mrtg>
# Order deny,allow
# Deny from all
Order allow,deny
Allow from all
Allow from 127.0.0.1
Allow from ::1
# Allow from .example.com
</Location>

后重新启动httpd(service httpd restart)正常访问。

原文地址:https://www.cnblogs.com/ratooner/p/5036464.html