2.安装awstats的命令(将awstats安装在/usr/local/awstats目录)
mkdir /var/lib/
wget http://prdownloads.sourceforge.net/awstats/awstats-6.95.tar.gz
tar zxvf awstats-6.95.tar.gz
mv awstats-6.95 /usr/local/awstats
cd /usr/local/awstats/tools/
perl awstats_configure.pl
3.Perl脚本awstats_configure.pl安装过程
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
- You are not an administrator user,
- You want to analyze downloaded log files without web server,
- You want to analyze mail or ftp log files instead of web log files,
- You need to analyze load balanced servers log files,
- You want to 'understand' all possible ways to use AWStats...
Read the AWStats documentation (docs/index.html).
Found Web server Apache config file '/usr/local/apache/conf/httpd.conf'
Warning: You Apache config file contains directives to write 'common' log files
This means that some features can't work (os, browsers and keywords detection).
Do you want me to setup Apache to write 'combined' log files [y/N] ? y 使用combined格式的访问日志
Add 'Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"'
Add 'Alias /awstatscss "/usr/local/awstats/wwwroot/css/"'
Add 'Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"'
Add 'ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"'
Add '<Directory>' directive
AWStats directives added to Apache config file.
File awstats.model.conf updated.
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y 创建一个awstats的配置文件
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name: 输入配置文件名称
> www.test.com
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default): 输入配置文件的路径
> /etc/awstats
Config file /usr/local/awstats/awstats.www.test.com.conf created.
httpd: unrecognized service 注意这里会重启apache
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.test.com
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/awstats_updateall.pl now
Press ENTER to continue...
A SIMPLE config file has been created: /usr/local/awstats/awstats.www.test.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'www.test.com' with command:
> perl awstats.pl -update -config=www.test.com
You can also read your statistics for 'www.test.com' with URL:
> http://localhost/awstats/awstats.pl?config=www.test.com
vi /etc/awstats/awstats.www.test.com.conf
LogFile="/var/log/httpd/access_log"
改为要分析的Apache日志路径与文件名
LogFile="/usr/local/awstats/tools/logresolvemerge.pl /var/apachelogs/20100220.log /var/apachelogs/20100220.log|"
LogFile="/opt/awstats/tools/logresolvemerge.pl /var/apachelogs/201002*.log|"
LogFile="gzip -d </var/log/apache/access.log.gz|"
注销LoadPlugin="decodeutfkeys"前面的# 否则搜索关键字可能有乱码
mkdir -p /var/lib/awstats
6. 更新分析报告
perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www.test.com -update
http://localhost/awstats/awstats.pl?config=www.test.com
这里的www.test.com对应/usr/local/awstats/awstats.www.test.com.conf 中的www.test.com
awstats是可以增加插件的。这个qqhostinfo插件,可以在访问主机表格中增加一列,显示ip对应的位置。
插件下载并复制到 awstats/plugins/目录下:
2. 下载分析QQWry.dat的perl脚本(qqwry.pl)。放在同一目录。
3. 修改,qqwry.pl中:
vi /usr/local/awstats/wwwroot/cgi-bin/plugins/qqwry.pl
./QQWry.Dat 修改为 ${DIR}/plugins/QQWry.Dat
4. 下载QQWry.Dat放在同一目录中,注意文件名一定要是QQWry.Dat
5. 编辑你得awstats配置文件,大概在LoadPlugin="hostinfo"的后面增加一行
LoadPlugin="qqhostinfo"
tar xvf Net-XWhois-0.70.tar
cd Net-XWhois-0.70
perl Makefile.PL
make
make install