centos下awstats安裝

tar zxvf awstats-7.0.tar.gz
cp awstats-7.0/docs/* htdocs/
cp -rf awstats-7.0 /usr/local/awstats
perl /usr/local/awstats/tools/awstats_configure.pl
vim /etc/httpd/conf/httpd.conf
加入http配置文件中
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/"

vim /etc/awstats/awstats.test.conf
LogFile="/data/wslogs/www.test.com-access.log_%YYYY-0%MM-0%DD-24" #修改後的
#awstats數據目錄
DirData="/var/lib/awstats" #默認
DirIcons="/icon" #默認
mkdir /data/wslogs
#若本服務器爲nginx或要日誌分析的所在服務器,則可不建立該目錄,該目錄主要作用是存放已按天切割完成的日誌,交給awstats
#創建IP庫的存放路徑
mkdir /usr/local/share/GeoIP
#生成數據文件,其默認存放在/var/lib/awstats
/usr/local/awstats/tools//usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=test

/usr/bin/htpasswd -c /usr/local/awstats/apachepasswd admin  創建密碼文件,用戶名admin
vim /etc/httpd/conf/httpd.conf
<Directory "/usr/local/awstats/wwwroot/">
   Options Indexes MultiViews Includes FollowSymLinks +ExecCGI
   AllowOverride None
   Order allow,deny
   Allow from all
   AuthType Basic
  AuthName "Restricted Files"
  AuthUserFile /usr/local/awstats/apachepasswd
  Require user pinladmin
</Directory>

#測試
http://test/awstats/awstats.pl?
注1:test既爲服務器IP或域名,同時又爲配置文件名
注2:創建awstats數據文件時,需按日誌時間從最早開始依次創建,否則會出現僅顯示第一個創建時間之後的數據,該時間之前的不會顯示

#安裝IP庫插件
tar zxvf Geo-IP-PurePerl-1.25.tar.gz
mv Geo-IP-PurePerl-1.25 /usr/local/awstats/Geo-IP-PurePerl
cd /usr/local/awstats/Geo-IP-PurePerl/
perl Makefile.PL
make
make install

GeoIP.dat.gz
vi /etc/awstats/awstats.test.conf
追加
LoadPlugin=”decodeutfkeys”
LoadPlugin=”geoip GEOIP_STANDARD /usr/local/share/GeoIP/GeoIP.dat”
#還可以加入城市IP庫,方法類似
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章