Chinaunix首页 | 论坛 | 博客
  • 博客访问: 555268
  • 博文数量: 114
  • 博客积分: 5611
  • 博客等级: 大校
  • 技术积分: 1027
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-19 08:55
文章分类

全部博文(114)

文章存档

2011年(29)

2010年(20)

2009年(1)

2008年(11)

2007年(53)

分类: LINUX

2007-04-19 21:40:28

首先拷贝 cronolog-1.6.2.tar.gz 到/home/pkg/soure 目录
tar –zxf /home/pkg/soure/cronolog-1.6.2.tar.gz
cd /home/pkg/cronolog-1.6.2
./configure
make
make check
make install
 
修改/usr/local/apache/log/httpd.conf

ServerName
DocumentRoot /var/www/vhost/
CustomLog "|/usr/local/sbin/cronolog /var/log/httpd/.%w.log" combined
 
建立/usr/local/apache/bin/httpd_log.sh
vi /usr/local/apache/bin/httpd_log.sh
rm -rf /var/log/httpd/.`date -d 1day +%w`.log
rm -rf /var/log/httpd/`date -d 1day +%w`.log
chmod 755 /usr/local/apache/bin/httpd_log.sh
加入自动运行
crontab –e
10 0 * * * /usr/local/apache/bin/httpd_log.sh
 
拷贝 awstats-6.4.gz 到 /home/pkg/source/
cd /usr/local
tar –zxf /home/pkg/source/ awstats-6.4.gz
mv awstats-6.4 awstats
chown -R root:vchkpw awstats
chmod -R 755 awstats
 
cd /usr/local/awstats/tools
perl awstats_configure.pl
Config file path ('none' to skip web server setup):
> /usr/local/apache/conf/httpd.conf
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y
Your web site, virtual server or profile name:
>
Directory path to store config file(s) (Enter for default):
> /usr/local/etc/awstats
 
修改主机配置(/usr/local/etc/awstats/awstats..conf),与httpd.conf保持一致:
·          
#LogFile="gzip -d < log.gz |"
#LogFile="awstats/tools/logresolvemerge.pl *.log |"
LogFile="/var/log/httpd/.%Dw-1.log"
LogType=W
LogFormat=1
SiteDomain=""
HostAliases="webfull.cn 192.168.0.100"
DNSLookup=2

DirData="/var/lib/awstats"
AllowToUpdateStatsFromBrowser=0
CreateDirDataIfNotExists=0
SaveDatabaseFilesWithPermissionsForEveryone=0
PurgeLogFile=0
ArchiveLogRecords=0
KeepBackupOfHistoricFiles=1

DefaultFile="index.htm index.html index.php"
SkipHosts="localhost REGEX[^192\.168\.]"
SkipFiles="REGEX[^\/images] REGEX[^\/css] REGEX[^\/scripts] REGEX[^\/awstats] REGEX[^*\.gif]"
Lang="auto"

#LoadPlugin="decodeutfkeys"
#LoadPlugin="hashfiles"
#LoadPlugin="geoip GEOIP_STANDARD"
#LoadPlugin="userinfo"
#LoadPlugin="hostinfo"

#Include ""
·         安装过程会自动在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/"

Options None
AllowOverride None
Order allow,deny
Allow from all
·         重启Apache:
/usr/local/apache/bin/apachetl restart
·         升级搜索引擎:
cd /usr/local/awstats/wwwroot/cgi-bin/lib
wget
·         统计旧的主机日志:
mkdir -p /var/lib/awstats
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config= \
-update -Logfile=/var/log/httpd/.log
·         定时统计所有主机日志:
0 * * * * /usr/local/awstats/tools/awstats_updateall.pl now -configdir=/usr/local/etc/awstats
·         测试:

  • plugin
awstats支持插件功能,以GeoIP为例:
网址:
cd /home/pkg/source
wget
cd ..
tar zxvf ./source/GeoIP-1.3.8.tar.gz
cd GeoIP-1.3.8; ./configure; make; make install
cd /home/pkg/source
wget
cd ..
tar zxvf ./source/Geo-IP-1.25.tar.gz
cd Geo-IP-1.25; perl Makefile.PL; make; make install
更新GeoIP库:
cd /usr/local/share/GeoIP/
wget
gunzip GeoIP.dat.gz
定时更新GeoIP库:
MAILTO=postmaster@funbsd.net
0 0 * * * /usr/local/bin/geoipupdate -v
也可以从pkg安装各插件(参考配置文件PLUGINS一节):
pkg_add -r p5-URI.tbz
pkg_add -r p5-Encode-HanConvert.tbz
pkg_add -r p5-Storable.tbz
pkg_add -r GeoIP.tbz
pkg_add -r p5-Geo-IP.tbz
pkg_add -r p5-Net-XWhois.tbz
加载插件(/usr/local/etc/awstats/awstats.):
LoadPlugin="decodeutfkeys"
LoadPlugin="hashfiles"
LoadPlugin="geoip GEOIP_STANDARD"
LoadPlugin="hostinfo"
 
阅读(1218) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~