在apache2.4上配置awstats后没权限,显示源码问题,报错总结

一、配置完毕之后,打开网址http://wgl.vip/awstats/awstats.pl?config=wgl.vip

You don’t have permission to access /awstats/awstats.pl on this server

解决办法:



在网上搜索说是要将/usr/local/awstats/wwwroot/cgi-bin目录中的awstats.pl权限设置为755甚至777,我设置了,发现照样是打不开的。后来发现一篇帖子,将
<Directory “/usr/local/awstats/wwwroot”>
Options Includes ExecCGI FollowSymlinks
AllowOverride None
Order allow,deny
Allow from all
Require all granted(主要是增加了这一行)
</Directory>

终于未提示403错误了,但是打开网址,却是显示的是源代码的,不得不继续分析下去:
#!/usr/bin/perl
#——————————————————————————
# Free realtime web server logfile analyzer to show advanced web statistics.
# Works from command line or as a CGI. You must use this script as often as
# necessary from your scheduler to update your statistics and from command
# line or a browser to read report results.
# See AWStats documentation (in docs/ directory) for all setup instructions.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/

在httpd.conf中有一行:
#LoadModule cgid_module modules/mod_cgid.so 去掉注释
LoadModule cgid_module modules/mod_cgid.so

二、针对多站点注意事项,配置过程与一个站点一样,但是需要修改日志格式
[root@localhost tools]# vim /etc/awstats/awstats.web2.a.com.conf
LogFormat=1 #改为4 “LogFormat=4”

重启httpd服务即可

-------------本文结束感谢您的阅读-------------