BT:yum install awstats 7.8 CentOS 7/8
5 年 ago jony BT:yum install awstats 7.8 CentOS 7/8已关闭评论
在BT环境下安装awstats和在LAMP下面会有点不一样,日志文件位置不一样,小改几个地方就可以了,很简单
1.yum upgrade
2.yum install awstats #注意版本号,看是不是自己想要的版本
3.awstats默认安装位置:/usr/share/awstats/
4.进入到/usr/share/awstats/tools/,运行perl awstats_configure.pl进行相关信息设置:
4.1
Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
这里输入你的apache httpd.conf配置文件路径。BT默认的在:/www/server/panel/vhost/apache/xxxxx.com..conf
4.2
-----> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? Y
4.3
-----> Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name: demo #默认就可以
4.4
Default: /etc/awstats
Directory path to store config file(s) (Enter for default): #默认,直接回车
到这里,这个文件夹配置就完成了
5.
5.1#cd /etc/awstats/
#vim awstats.demo.conf #这里个性一个地方即可,其它默认
5.2
LogFile="/var/log/httpd/access_log" #把路径换成你的访问日志文件路径即可.BT默认:/www/wwwlogs/xxxxx-access_log
6. 重启一下apache
7.读取日志文件,并分析生成报告
7.1
在URL能访问到的目录下创建一个文件夹,如TT,后面会要通过浏览器访问用
#/var/www/html/tt/
7.2
#分析日志文件并生成报告
#perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -update -config=demo -output -staticlinks >/var/www/html/tt/tt.html
7.3 这里可以给tt文件夹设置一个密码,禁止非授权用户访问
8.通过浏览器访问awstats

9.创建一个计划任务,让系统定时执行更新读取日志文件
- * * * * * * perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -update -config=demo -output -staticlinks >/var/www/html/tt/tt.html