awstats安装日志

1cd /usr/local/src

2)wget http://prdownloads.sourceforge.net/awstats/awstats-6.8.tar.gz

3)tar xzvf awstats-6.8.tar.gz

4)cp -r awstats-6.8 /usr/local/awstats

5)cd /usr/local/awstats/

6)perl /usr/local/awstats/tools/awstats_configure.pl

结果如下:

  1. ----->Checkforwebserverinstall
  2. EnterfullconfigfilepathofyourWebserver.
  3. Example:/etc/httpd/httpd.conf
  4. Example:/usr/local/apache2/conf/httpd.conf
  5. Example:c:/Programfiles/apachegroup/apache/conf/httpd.conf
  6. Configfilepath('none'toskipwebserversetup):
  7. >/etc/httpd/conf/httpd.conf
  8. ----->Checkandcompletewebserverconfigfile'/etc/httpd/conf/httpd.conf'
  9. Add'Alias/awstatsclasses"/usr/local/awstats/wwwroot/classes/"'
  10. Add'Alias/awstatscss"/usr/local/awstats/wwwroot/css/"'
  11. Add'Alias/awstatsicons"/usr/local/awstats/wwwroot/icon/"'
  12. Add'ScriptAlias/awstats/"/usr/local/awstats/wwwroot/cgi-bin/"'
  13. Add'<Directory>'directive
  14. AWStatsdirectivesaddedtoApacheconfigfile.
  15. ----->Updatemodelconfigfile'/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf'
  16. Fileawstats.model.confupdated.
  17. ----->Needtocreateanewconfigfile?
  18. DoyouwantmetobuildanewAWStatsconfig/profile
  19. file(requirediffirstinstall)[y/N]?y
  20. ----->Defineconfigfilenametocreate
  21. Whatisthenameofyourwebsiteorprofileanalysis?
  22. Example:www.mysite.com
  23. Example:demo
  24. Yourwebsite,virtualserverorprofilename:
  25. >tracker.yihaodian.com
  26. ----->Defineconfigfilepath
  27. Inwhichdirectorydoyouplantostoreyourconfigfile(s)?
  28. Default:/etc/awstats
  29. Directorypathtostoreconfigfile(s)(Enterfordefault):
  30. >
  31. ----->Createconfigfile'/etc/awstats/awstats.tracker.yihaodian.com.conf'
  32. Configfile/etc/awstats/awstats.tracker.yihaodian.com.confcreated.
  33. ----->RestartWebserverwith'/sbin/servicehttpdrestart'
  34. Stoppinghttpd:[OK]
  35. Startinghttpd:httpd:Couldnotdeterminetheserver'sfullyqualifieddomainname,using127.0.0.1forServerName
  36. [OK]
  37. ----->Addupdateprocessinsideascheduler
  38. Sorry,configure.pldoesnotsupportautomaticaddtocronyet.
  39. Youcandoitmanuallybyaddingthefollowingcommandtoyourcron:
  40. /usr/local/awstats/wwwroot/cgi-bin/awstats.pl-update-config=tracker.yihaodian.com
  41. Orifyouhaveseveralconfigfilesandpreferhavingonlyonecommand:
  42. /usr/local/awstats/tools/awstats_updateall.plnow
  43. PressENTERtocontinue...
  44. ASIMPLEconfigfilehasbeencreated:/etc/awstats/awstats.tracker.yihaodian.com.conf
  45. Youshouldhavealookinsidetocheckandchangemanuallymainparameters.
  46. Youcanthenmanuallyupdateyourstatisticsfor'tracker.yihaodian.com'withcommand:
  47. >perlawstats.pl-update-config=tracker.yihaodian.com
  48. Youcanalsoreadyourstatisticsfor'tracker.yihaodian.com'withURL:
  49. >http://localhost/awstats/awstats.pl?config=yoursite.com
  50. PressENTERtofinish...

7)只需修改/etc/awstats/awstats.yoursite.com.conf的logfile

logfile为你的服务器的access.log

本例中使用的nginx, 发现awstats完全可以解析nginx的日志

8)产生日志数据

8.1)产生日志目录:

mkdir /var/lib/awstats

8.2)产生日志数据

你能通过如下命令手工产生统计数据,通常是刚刚安装之后

/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=yoursite.com

接下来你需要通过crontab来定时跑上面的脚本

9)通过url访问

http://localhost/awstats/awstats.pl?config=yoursite.com

总结:

awstats通过分析本地服务器的日志文件得到流量统计数据,默认是按月统计,在安装过程中通过改写apache的配置文件,使得可以通过apache看到统计数据表

你可能感兴趣的:(安装)