- 論壇徽章:
- 0
|
#####################################
#
#
# 環(huán)境
#
#
http://www.awstats.org/
#
# 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腳本安裝 回答一些問(wèn)題。 操作步驟如下:
-----------------------------------------------------------------------------------------------
1.改變apache配置文件中l(wèi)og格式由 "common" -> "combined"
2.改變apche配置文件,添加awstats內(nèi)容。
# 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.詢(xún)問(wèn)你,提出一個(gè)配置文件名,在/etc/awstats/下,創(chuàng)建相關(guān)配置文件
如:"test.com" -> "awstats.test.com.conf"
#####################
#
# web AuthBasic驗(yàn)證
#
#####################
# 修改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
####################################
#
# 設(shè)置 配置文件 /var/awstats/...conf
#
####################################
vim /etc/awstats/awstats.test.com.conf
# 日志檔位置
LogFile="/usr/local/apache2213/logs/access_log"
# 日志檔類(lèi)型:W – WEB,S – Streaming,M – Mail,F(xiàn) – FTP
LogType=W
# 日志格式 缺省值是1:Apache日志,2是IIS日志
LogFormat=1
# 主機(jī)名稱(chēng)或網(wǎng)域
SiteDomain="test"
# 主機(jī)別名
HostAliases="test
www.test
127.0.0.1 localhost"
# 存放 awstats 分析完成的資料庫(kù)檔案存放目錄
# "." 保存在 /awstats當(dāng)前目錄 即.../wwwroot/cgi-bin/目錄
DirData="."
# 執(zhí)行 awstats 的目錄:更改成之前在 httpd.conf 或 awstats.conf 中設(shè)定 ailas 的路徑
DirCgi=”/awstats”
# 圖示目錄:更改成之前在 httpd.conf 或 awstats.conf 中設(shè)定 ailas 的路徑
DirIcons="/awstatsicons"
# 是否允許在統(tǒng)計(jì)頁(yè)面直接更新數(shù)據(jù)1:允許 0:不允許
AllowToUpdateStatsFromBrowser=1
###################
#
# 刷新 數(shù)據(jù)
#
###################
/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)
######################
#
# 靜態(tài) html 訪(fǎng)問(wèn)
#
######################
/usr/local/awstats-6.9/wwwroot/cgi-bin/awstats.pl -config=test -output -staticlinks > test.html
######################
#
# 動(dòng)態(tài).pl 訪(fǎng)問(wèn)
#
######################
# 監(jiān)控頁(yè)面
http://192.168.5.20/awstats/awstats.pl?config=test
######################
#
# GeoIP
#
######################
##################
# GeoIP C Library
cd ~
aptitude install zlib1g-dev
wget
http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
tar zxvf GeoIP.tar.gz
cd GeoIP-1.4.6
./configure
make;make install
#####################
# Geo::IP Perl Module
cd ~
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
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地址數(shù)據(jù)庫(kù) 下載
cd /usr/local/awstats-6.9/wwwroot/cgi-bin/
wget
http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
wget
http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip Geo*
######################
#
# qq hostinfo 插件
#
######################
###########
# 下載 插件
cd /usr/local/awstats-6.9/wwwroot/cgi-bin/plugins
wget
http://www.ieasy.org/download/qqhostinfo.pm
wget
http://www.ieasy.org/download/qqwry.pl
#################
# 下載 QQIP數(shù)據(jù)庫(kù)
# patch: /usr/local/awstats-6.9/wwwroot/cgi-bin
#
http://www.cz88.net/fox/
################
# 修改 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 滾動(dòng)日志
CustomLog "|/usr/sbin/cronolog /data/logfile/access_%Y-%m-%d.log" combined
# 對(duì)應(yīng) awstats 配置文件
LogFile="/data/logfile/access_%YYYY-24%MM-24%DD-24.log"
本文來(lái)自ChinaUnix博客,如果查看原文請(qǐng)點(diǎn):http://blog.chinaunix.net/u1/45949/showart_2043219.html |
|