awstats日志分析系统部署

1.确认apache已经安装:

netstat -utpln |grep 80

wKiom1gsRyKyTcHQAAASLbWQdns985.png-wh_50 

2.下载与解压:

lftp ftp.linuxfan.cn-->cd tools-->get awstats-7.3.tar.gz

tar zxvf awstats-7.3.tar.gz

wKiom1gsRyqTMUzVAAAReMWBXOw738.png-wh_50  

mv awstats-7.3  /usr/local/awstats

wKioL1gsRzjxjrfYAAAIzOrjiQ8995.png-wh_50 

3.配置awstats:

cd  /usr/local/awstats/tools

chmod +x ./*

wKiom1gsR0HD3KhzAAAq-aNkJUA830.png-wh_50 

./awstats_configure.pl

 

#####开始配置###

a.当提示输入httpd.conf时输入并回车继续:

/usr/local/httpd/conf/httpd.conf

wKioL1gsR0ryxCeXAAAjiy8iOqs383.png-wh_50 

b.其他提示输入:y回车继续

c.当提示配置文件名称时,输入:

www.linuxfan.cn

####配置结束###

wKioL1gsR1LxC-cIAABP_vIB_as383.png-wh_50 

4.修改awstats配置文件:

vim /etc/awstats/awstats.www.linuxfan.cn.conf

LogFile="/usr/local/httpd/logs/access_log"   ##修改第 50 行

:wq

wKiom1gsR1yx8MvUAAAsibMS2Ms199.png-wh_50 

mkdir /var/lib/awstats

wKioL1gsR2OSIP1aAAAGc58lDyE139.png-wh_50 

5.设置计划任务并重启服务器:

echo "*/5 * * * *  /usr/local/awstats/tools/awstats_updateall.pl now" >/var/spool/cron/root   ##每个5分更新一次

wKioL1gsR3PALfdFAAA9jquTz9c490.png-wh_50wKiom1gsR2vidZw9AAAL9xNlMIE747.png-wh_50 

/usr/local/awstats/tools/awstats_updateall.pl now  ##执行首次更新

 

/usr/local/httpd/bin/apachectl  restart

netstat -utpln |grep 80

wKiom1gsR4eRyYvYAAAPS2_bZk4808.png-wh_50 

/etc/init.d/crond  restart

wKiom1gsR5Czjn_mAAAOxVqrbfo761.png-wh_50 

crontab -l

chkconfig crond on

wKioL1gsR5eRBYuDAAATl16mnmk974.png-wh_50 

6.访问测试:

http://www.linuxfan.cn/awstats/awstats.pl?config=www.linuxfan.cn

wKioL1gsR56gk2QfAAH3p3Y4gdQ385.png-wh_50 

编写简化页面:

vim /usr/local/httpd/htdocs/aws.html

<html>

  <head>

    <meta http-equiv="refresh" content="0; url=http://www.linuxfan.cn/awstats/awstats.pl?config=www.linuxfan.cn" />

  </head>

  <body></body>

</html>

:wq

访问:

http://www.linuxfan.cn/aws.html

wKiom1gsR6XDQXHnAACmNg5ycVM010.png-wh_50