Chinaunix首页 | 论坛 | 博客
  • 博客访问: 379382
  • 博文数量: 89
  • 博客积分: 3176
  • 博客等级: 中校
  • 技术积分: 1205
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-15 10:08
文章分类

全部博文(89)

文章存档

2011年(17)

2010年(19)

2009年(35)

2008年(18)

分类: LINUX

2009-09-01 16:28:53

#####################################
#
#
#              环境
#
#   
#
#       debian_lenny_x32
#       awstats-6.9
#
#
#####################################


###################
#
#      安装
#
###################

cd ~
aptitude install bzip2
aptitude install build-essential

wget http://downloads.sourceforge.net/project/awstats/AWStats/6.9/awstats-6.9.tar.gz?use_mirror=ncu
tar zxvf awstats-6.9.tar.gz
mv awstats-6.9 /usr/local/


/usr/local/awststs-6.9/tools/awstats_configure.pl # perl脚本安装 回答一些问题。 操作步骤如下:
-----------------------------------------------------------------------------------------------
1.改变apache配置文件中log格式由 "common" -> "combined"
2.改变apche配置文件,添加awstats内容。
 # Directives to add to your Apache conf file to allow use of AWStats as a CGI.
 # Note that path "/usr/local/awstats/" must reflect your AWStats Installation path.
 #
 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.
 #
 
 Options None
 AllowOverride None
 Order allow,deny
 Allow from all
 

3.重启apache
4.询问你,提出一个配置文件名,在/etc/awstats/下,创建相关配置文件
 如:"test.com" -> "awstats.test.com.conf"

 

#####################
#
#  web AuthBasic验证
#
#####################

# 修改apache配置文件

vim /usr/local/apache2213/conf/httpd.conf
------------------------------------------------------

AuthUserFile /usr/local/apache2213/conf/.passwd
AuthName "Restricted Area For Customers"
AuthType Basic
require valid-user


/usr/local/apache2213/bin/htpasswd -c /usr/local/apache2212/conf/.passwd admin# 生成Passwd文件

cd /usr/local/apache2213/conf/
chown daemon.daemon .passwd
chmod 700 .passwd

 

####################################
#
#   设置 配置文件 /var/awstats/...conf
#
####################################

vim /etc/awstats/awstats.test.com.conf

# 日志档位置
LogFile="/usr/local/apache2213/logs/access_log"

# 日志档类型:W – WEB,S – Streaming,M – Mail,F – FTP
LogType=W

# 日志格式 缺省值是1:Apache日志,2是IIS日志
LogFormat=1

# 主机名称或网域
SiteDomain="test"

# 主机别名
HostAliases="test 127.0.0.1 localhost"

# 存放 awstats 分析完成的资料库档案存放目录
# "." 保存在 /awstats当前目录 即.../wwwroot/cgi-bin/目录
DirData="."

# 执行 awstats 的目录:更改成之前在 httpd.conf 或 awstats.conf 中设定 ailas 的路径
DirCgi=”/awstats”

# 图示目录:更改成之前在 httpd.conf 或 awstats.conf 中设定 ailas 的路径
DirIcons="/awstatsicons"

# 是否允许在统计页面直接更新数据1:允许 0:不允许
AllowToUpdateStatsFromBrowser=1


###################
#
#    刷新 数据
#
###################

/usr/local/awstats-6.9/wwwroot/cgi-bin/awstats.pl -config=test -update
----------------------------------------------------------------------------------------------------------
Create/Update database for config "/etc/awstats/awstats.test.conf" by AWStats version 6.9 (build 1.925)
From data in log file "/usr/local/apache2213/logs/access_log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 166
 Found 0 dropped records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 166 new qualified records.

 

###################
#
#    crontab
#
###################

crontab -e
* */1 * * * (cd /usr/local/awstats-6.9/cgi-bin/; ./awstats.pl -config=test -update)


######################
#
#    静态 html 访问
#
######################

/usr/local/awstats-6.9/wwwroot/cgi-bin/awstats.pl -config=test -output -staticlinks > test.html


######################
#
#    动态.pl 访问
#
######################

# 监控页面


######################
#
#      GeoIP
#
######################

##################
# GeoIP C Library
cd ~
aptitude install zlib1g-dev
wget
tar zxvf GeoIP.tar.gz
cd GeoIP-1.4.6
./configure
make;make install


#####################
# Geo::IP Perl Module 
cd ~
wget
tar zxvf Geo-IP-1.38.tar.gz
cd Geo-IP-1.38
perl Makefile.PL
make
make test
make install

##################
# 修改  配置文件
LoadPlugin=”tooltips”
LoadPlugin=”geoip GEOIP_STANDARD /usr/local/awstats-6.9/wwwroot/cgi-bin/GeoIP.dat”
LoadPlugin=”geoip_city_maxmind GEOIP_STANDARD /usr/local/awstats-6.9/wwwroot/cgi-bin/GeoLiteCity.dat”

#######################
# ip地址数据库 下载
cd /usr/local/awstats-6.9/wwwroot/cgi-bin/
wget
wget
gunzip Geo*


######################
#
#  qq hostinfo 插件
#
######################

###########
# 下载 插件
cd /usr/local/awstats-6.9/wwwroot/cgi-bin/plugins
wget
wget

#################
# 下载 QQIP数据库 

# patch: /usr/local/awstats-6.9/wwwroot/cgi-bin
#


################
# 修改 IP分析脚本
vim /usr/local/awstats-6.9/wwwroot/cgi-bin/plugins/qqwry.pl
# 修改 QQWry.Dat 的目录
---------------------------------------------------------------
...
my $ipfile="/usr/local/awstats-6.9/wwwroot/cgi-bin/QQWry.Dat";
...


#########################################
# 修改 awstats 配置文件 添加qqhostinfo插件
# 大概在LoadPlugin="hostinfo"的后面增加一行  LoadPlugin="qqhostinfo"

vim /etc/awstats/awstats.test.conf
-------------------------------------
...
#LoadPlugin="hostinfo"
LoadPlugin="qqhostinfo"
...

 

 

########################################################################################################################
# 其他

# apache 滚动日志
CustomLog "|/usr/sbin/cronolog /data/logfile/access_%Y-%m-%d.log" combined

# 对应 awstats 配置文件
LogFile="/data/logfile/access_%YYYY-24%MM-24%DD-24.log"

 

 

 

 

 

 

 

 

 


 

阅读(1073) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~