http://sourceforge.net/projects/awstats/
#wget http://nchc.dl.sourceforge.net/sourceforge/awstats/awstats-6.8.tar.gz
车东的内主要搜索引擎和蜘蛛定义
#wget http://www.chedong.com/tech/lib.tgz
下载GeoIP的应用库:C
http://www.maxmind.com/download/geoip/api/c/
#wget http://www.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
下载GeoIP/GeoIPCityLite包:解包并部署到awstats目录下
#wget http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
#wget http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
# tar zxvf GeoIP.tar.gz
#cd GeoIP-1.4.4
#./configure
#make && make install
#cd ..
#tar zxvf awstats-6.8.tar.gz
#mv awstats-6.8 /opt/awstats
#gunzip lib.tgz
#tar xvf lib.tar
覆盖原文件
#\cp -a lib/* /opt/awstats/wwwroot/cgi-bin/lib/
#gunzip GeoIP.dat.gz
#gunzip GeoLiteCity.dat.gz
#cp GeoIP.dat /opt/awstats/wwwroot/cgi-bin/plugins/
#cp GeoLiteCity.dat /opt/awstats/wwwroot/cgi-bin/plugins/
设置权限
#chown -R www:website /opt/awstats
#chmod 0755 //opt/awstats/wwwroot/cgi-bin/plugins/Geo*
perl -MCPAN -e ‘install “Geo::IP”‘ 或者使用纯Perl包 perl -MCPAN -e ‘install “Geo::IP::PurePerl”‘
#perl -MCPAN -e ‘install “Geo::IP”‘
一路回车到底
如果失败可以手动安装Geo::IP,并指定库的路径
#wget http://geolite.maxmind.com/download/geoip/api/perl/Geo-IP-1.38.tar.gz
#tar zxvf Geo-IP-1.38.tar.gz
#cd Geo-IP-1.38
#perl Makefile.PL LIBS=’-L/usr/local/lib’ INC=’-I/usr/local/include’
#make && make install
配置awstats
#cd /opt/awstats/tools/
#perl awstats_configure.pl
—–> Running OS detected: Linux, BSD or Unix
Warning: AWStats standard directory on Linux OS is ‘/usr/local/awstats’.
If you want to use standard directory, you should first move all content
of AWStats distribution from current directory:
/opt/awstats
to standard directory:
/usr/local/awstats
And then, run configure.pl from this location.
Do you want to continue setup from this NON standard directory [yN] ?
y
—–> Check for web server install
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):
指定httpd.conf的路径,我用nginx输入none
—–> Update model config file ‘/opt/awstats/wwwroot/cgi-bin/awstats.model.conf’
File awstats.model.conf updated.
—–> 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] ?
我使用手工写的conf所以输入n
—–> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/opt/awstats/wwwroot/cgi-bin/awstats.pl -update -config=myvirtualserver
Or if you have several config files and prefer having only one command:
/opt/awstats/tools/awstats_updateall.pl now
Press ENTER to continue…
然后回车
将缺省awstats.model.conf 命名成common.conf
#cd ../wwwroot/cgi-bin/
#mv awstats.model.conf common.conf
修改其中的一些配置选项:
#vi common.conf
按”/”输入decodeutfkeys
去掉此行前的”#”
LoadPlugin=”decodeutfkeys”
查找geoip GEOIP_STANDARD和geoip_city_maxmind ,去掉注释并改成你的路径
LoadPlugin=”geoip GEOIP_STANDARD /opt/awstats/wwwroot/cgi-bin/plugins/GeoIP.dat”
LoadPlugin=”geoip_city_maxmind GEOIP_STANDARD /opt/awstats/wwwroot/cgi-bin/plugins/GeoLiteCity.dat
按照一下样例设置配置文件:
#vi /etc/awstats/awstats.www.c1gstudio.com.conf
Include “/opt/awstats/wwwroot/cgi-bin/common.conf”
LogFile=”gzip -d </opt/nginx/logs/www.c1gstudio.com.%YYYY-24%MM-24%DD-24.log.gz |”
SiteDomain=”www.c1gstudio.com”
HostAliases=”c1gstudio.com127.0.0.1 localhost”
DirData=”/var/lib/awstats”
创建数据目录
#mkdir /var/lib/awstats
成生报告
#perl /opt/awstats/wwwroot/cgi-bin/awstats.pl -config=www.c1gstudio.com -update
查看报告
http://www.c1gstudio.com/cgi-bin/awpstats.pl?config=www.c1gstudio.com
定时更新
10 5 * * * (cd /opt/awstats/wwwroot/cgi-bin/;./awstats.pl -update -config=www.c1gstudio.com)
参考资料
http://www.chedong.com/tech/awstats.html
http://blog.s135.com/read.php/199.htm
测试环境
as4 nginx0.6.32
No Responses (yet)
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.