分类: LINUX
2010-09-16 08:51:47
安装awstats:
[root@localhost ~]#tar zxvf awstats-6.95.tar.gz
[root@localhost ~]#mkdir /usr/local/awstats
[root@localhost ~]#cd awstats-6.95
[root@localhost ~]#cp -a * /usr/local/awstats/
[root@localhost ~]#mkdir /var/lib/awstats
[root@localhost ~]#cd /usr/local/awstats/tools
[root@localhost ~]#perl awstats_configure.pl (会有一些提示,按实际情况填写即可)
配置apache:
[root@localhost ~]#vim /etc/httpd/conf/httpd.conf
ServerName awstats.futuotech.net
DocumentRoot /usr/local/awstats/wwwroot/
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/"
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "awstats"
AuthType Basic
AuthUserFile /usr/local/awstats/pass
Require valid-user
[root@localhost ~]#cd /usr/local/awstats
[root@localhost ~]#htpasswd -c pass admin
修改配置文件
[root@localhost ~]#vim/etc/awstats/awstats. (分析apache日志)
LogFile="/home/cm/access_%YYYY-24%MM-24%DD-24.log"
LogFormat=1
SiteDomain=""
HostAliases=
[root@localhost ~]#vim/etc/awstats/awstats. (分析IIS日志)
LogFile="/mnt/%YY-24%MM-24%DD-24.log"
LogFormat="date time cs-method cs-uri-stem cs-uri-query cs-username c-ip cs-version cs(User-Agent) cs(Referer) sc-status sc-bytes"
SiteDomain=""
HostAliases=""
LoadPlugin="timezone +8" (IIS记录日志时间是0时区时间,这里加8个小时)
#contab -e
20 01 * * * perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=
25 08 * * * perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=
注意分析IIS日志时要设置IIS日志取这些字段:date time cs-method cs-uri-stem cs-uri-query cs-username c-ip cs-version cs(User-Agent) cs(Referer) sc-status sc-bytes (不一定要取这些,IIS日志格式与awstats里格式保持一致即可)
perl/usr/local/awstats/wwwroot/cgi-bin/awstats.pl-config=-update -databasebreak=day
按日更新数据
perl/usr/local/awstats/wwwroot/cgi-bin/awstats.pl-update-config=
按月更新数据
安装插件显示访问者国家,城市:
安装GeoIP
Geo-IP C-API:
[root@localhost ~]#tar xzvf geo-ip-c.tar.gz
[root@localhost ~]#./configure
[root@localhost ~]#make
[root@localhost ~]#make install
Geo-IP Perl-API:
[root@localhost ~]#tar xzvf geo-ip-per.tar.gz
[root@localhost ~]#perl MakeFile.PL (32Bit)
[root@localhost ~]#perl Makefile.PL LIBS='-L/usr/local/lib' INC='-I/usr/local/include' (64Bit)
[root@localhost ~]#make
[root@localhost ~]#make install
Geo::IPfree
[root@localhost ~]#tar xzvf geo-ipfree.tar.gz
[root@localhost ~]#perl MakeFile.PL
[root@localhost ~]#make
[root@localhost ~]#make install
修改配置文件:
LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/local/share/GeoIP/GeoLiteCity.dat"
LoadPlugin="geoip GEOIP_STANDARD /usr/local/share/GeoIP/GeoIP.dat"
访问:
完成!