1安装lnmp模式
2安装awstats
- 2# tar xf awstats-6.5.tar.gz 解压下载到/root下的压缩包
-
mkdir /var/lib/awstats
-
chmod 755 /usr/local/awstats
- #cp -R awstats-6.5/ /usr/local/awstats
-
cd /usr/local/awstats/ 进入到解压目录下
-
ls
- docs README.TXT tools wwwroot
-
cd tools/
-
ls
-
perl awstats_configure.pl
1 Config file path (‘none’ to skip web server setup):
none 默认填写none就OK
2 Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y 默认yes就OK
3 Your web site, virtual server or profile name:
www.linuxidc.com 上面介绍过通过www.linuxidc.com来访问 并针对这个页面进
行日志分析
4 Default: /etc/awstats 默认的配置文件存放位置
Directory path to store config file(s) (Enter for default):
敲enter键默认即可
OK 交互界面结束
2 配置awstats的配置文件
-
cd /etc/awstats
-
vim awstats.www.linuxidc.com.conf
- //修改一下几项即可 其它都可以默认
- LogFile="/var/log/httpd/access_log"
- DirData="/var/lib/awstats"
- DirCgi="/awstats"
- DirIcons="/awstatsicons"
- //执行下面的命令
-
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=bbs.linuxidc.com
4 配置web的配置文件
vim /etc/httpd/conf/httpd.conf
//在行尾添加如下内容
- Alias /awstatsclasses “/usr/local/awstats/wwwroot/classes/”
- Alias /awstatscss “/usr/local/awstats/wwwroot/css/”
- Alias /awstatsicons “/usr/local/awstats/wwwroot/icon/”
- ScriptAlias /awstats/ “/usr/local/awstats/wwwroot/cgi-bin/”
-
This is to permit URL access to scripts/files in AWStats directory.
-
- <Directory “/usr/local/awstats/wwwroot”>
-
Options None
-
AllowOverride None
-
Order allow,deny
-
Allow from all
- //保存退出
5 重启服务
#service httpd restart
6、手动更新网站的统计数据cd /usr/local/awstats/wwwroot/cgi-bin/
perl awstats.pl -update -config=www.linuxidc.com
注: 如果需要将某统计信息生成为静态的html页面,使用以下命令即可实现:
perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -output=pagetype -config=www.linuxidc.com > /var/www/html/awstats.www.linuxidc.com.html 7、将上面的命令放入定期任务列表中
1 5 * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.linuxidccom >/dev/null 2>&1