- 论坛徽章:
- 0
|
1、下载安装
wget http://prdownloads.sourceforge.net/awstats/awstats-6.1.tgz
2、解压缩 awstats-6.1.tgz
3、将解压出来的 awstats-6.1目录复制到 /usr/local/ 目录下,并重命名为awstats
4、进到/usr/local/awstats/tools目录下,执行./configure.pl
将出现以下情况
设定config档
----- AWStats configure 1.0 (build 1.32) (c) Laurent Destailleur -----
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).
-----> Running OS detected: Linux, BSD or Unix
-----> Check for web server install
Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
> /etc/httpd/conf/httpd.conf <-----输入httpd.conf的绝对路径,不输也可以,输入none跳过
-----> Check and complete web server config file '/etc/httpd/conf/httpd.conf'
AWStats directives already present.
-----> Update model config file '/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf'
File awstats.model.conf updated.
-----> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ?y
-----> Define config file name to create
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:
> 这里输入域名 <-------- 输入你所要建立的WebSite name
-----> Add update process inside a scheduler
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=wwww.myunix.idv.tw
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: /etc/awstats/awstats.wwww.myunix.idv.tw.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'wwww.myunix.idv.tw' with command:
> perl awstats.pl -update -config=wwww.myunix.idv.tw
You can also read your statistics for 'wwww.myunix.idv.tw' with URL:
> http://localhost/awstats/awstats.pl?config=域名
Press ENTER to finish...
按回车退出
5、以上步驟完成后,會在/etc/awstats目录下建立一档案- awstats.域名.conf
6、建立 /var/lib/awstats 目录,并給予 777 之权
7、设定 httpd.conf,检查在/etc/httpd/conf/httpd.conf中是否有以下设定,如果沒有的话,请自行加入,并重新启动httpd服务
在httpd.conf最后加入以下内容
#
# 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 install 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.
#
<Directory "/usr/local/awstats/wwwroot">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
8、设定/etc/awstats/awstats.域名.conf
LogFile="perl /usr/local/awstats/tools/maillogconvert.pl standard < /var/log/maillog |" <----指定你mail log file的绝对及log名称
LogType=M <---- M代表分析类型为mail log files
LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd"
SiteDomain="mail.myunix.idv.tw" <----指定从log档中过滤符合SiteDomain的记录
HostAliases="myunix.idv.tw mail.myunix.idv.tw localhost 127.0.0.1" <-----指定哪些Domain或ip address為Local,其余皆视为External
LevelForBrowsersDetection=0
LevelForOSDetection=0
LevelForRefererAnalyze=0
LevelForRobotsDetection=0
LevelForWormsDetection=0
LevelForSearchEnginesDetection=0
LevelForFileTypesDetection=0
ShowMenu=1
ShowMonthStats=HB
ShowDaysOfMonthStats=HB
ShowDaysOfWeekStats=HB
ShowHoursStats=HB
ShowDomainsStats=0
ShowHostsStats=HBL
ShowAuthenticatedUsers=0
ShowRobotsStats=0
ShowEMailSenders=HBML
ShowEMailReceivers=HBML
ShowSessionsStats=0
ShowPagesStats=0
ShowFileTypesStats=0
ShowFileSizesStats=0
ShowBrowsersStats=0
ShowOSStats=0
ShowOriginStats=0
ShowKeyphrasesStats=0
ShowKeywordsStats=0
ShowMiscStats=0
ShowHTTPErrorsStats=0
ShowSMTPErrorsStats=1
修改完之后保存退出
9、执行awstats.pl,记得指定设定档时,不要输入设定档名前面的 awstats. 及 .conf
[root@weiqishan]#/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=域名 –update
如果出现以下信息,就代表执行成功
Update for config "/etc/awstats/awstats.mail.myunix.idv.tw.conf"
With data in log file "perl /usr/local/awstats/tools/maillogconvert.pl standard < /var/log/maillog |"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 358
Found 0 dropped records,
Found 0 corrupted records,
Found 358 old records,
Found 0 new qualified records.
分享一下,按照这做肯定成功。 |
|