Awstats是一个免费非常简洁而且强大有个性的网站日志分析工具。

功能:

一:访问量,访问次数,页面浏览量,点击数,数据流量等
二:精确到每月、每日、每小时的数据
三:访问者国家
四:访问者IP
五:Robots/Spiders的统计
六:访客持续时间
七:对不同Files type 的统计信息
八:Pages-URL的统计
九:访客操作系统浏览器等信息
十:其它信息(搜索关键字等等)
 
1.安装httpd
  1. [root@www /]# tar zxvf httpd-.tar.gz -C /usr/src/
  2. [root@www /]# unzip awstats-7.0.zip
  3. [root@www /]# ./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi && make && make install
  • --prefix:指定安装目录
  • --enable-so:启用动态加载模块支持
  • --enable-rewrite:启用网站重写功能
  • --enable-charset-lite:启动字符集支持
  • --enable-cgi:启用CGI脚本程序支持
    1. [root@www httpd-]# ln -s /usr/local/httpd/bin/* /usr/local/bin/ //优化执行路径
    2. [root@www ~]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
  1. [root@www ~]# vim /etc/init.d/httpd
  2. #chkconfig: 35 85 15
  3. #description: Apache HTTP Server
  1. [root@www ~]# chkconfig --add httpd
  2. [root@www ~]# chkconfig --level httpd on
  3. [root@www ~]# vim /usr/local/httpd/conf/httpd.conf
  4. ServerName www.aaa.com: //添加网站域名
  5. [root@www ~]# httpd t //检查配置文件错误
  6. Syntax OK
  7. [root@www ~]# /etc/init.d/httpd start
  1. [root@www ~]# netstat -anpt |grep
  2. tcp ::: :::* LISTEN /httpd
  3. [root@www ~]# elinks http://192.168.1.200
  4. It works!

基于不同的域名创建虚拟Web主机

为两个站点创建网站的文档目录

  1. [root@www ~]# mkdir /usr/local/httpd/htdocs/aaacom
  2. [root@www ~]# mkdir /usr/local/httpd/htdocs/bbbcom
  3. [root@www ~]# echo '<h1>www.aaa.com</h1>' > /usr/local/httpd/htdocs/aaacom/index.html
  4. [root@www ~]# echo '<h1>www.bbb.com</h1>' > /usr/local/httpd/htdocs/bbbcom/index.html
  5. 修改配置文件httpd.confhttpd-vhosts.conf
  6. [root@www ~]# cd /usr/local/httpd/conf/extra/
  7. [root@www extra]# vim httpd-vhosts.conf
  8. NameVirtualHost
  9.  
  10. <VirtualHost >
  11. DocumentRoot "/usr/local/httpd/htdocs/aaacom/"
  12. ServerName www.aaa.com
  13. ErrorLog "logs/www.aaa.com-error_log"
  14. CustomLog "logs/www.aaa.com-access_log" common
  15. </VirtualHost>
  16.  
  17. <VirtualHost >
  18. DocumentRoot "/usr/local/httpd/htdocs/bbbcom/"
  19. ServerName www.bbb.com
  20. ErrorLog "logs/www.bbb.com-error_log"
  21. CustomLog "logs/www.bbb.com-access_log" common
  22. </VirtualHost>
  23. [root@www extra]# cd ..
  24. [root@www conf]# vim httpd.conf
  25. Include conf/extra/httpd-vhosts.conf //将此行前面的"#"去掉
  26. [root@www ~]# vim /etc/hosts
  27. 192.168.1.200 www.aaa.com www.bbb.com
  28. [root@www ~]# /etc/init.d/httpd restart
  29. [root@www ~]# elinks http://www.aaa.com
  30. www.aaa.com
  31. [root@www ~]# elinks http://www.bbb.com
  32. www.bbb.com

二、

部署安装awstats日志分析系统

  1. [root@www /]# unzip awstats-7.0.zip
  2. [root@www /]# mv awstats-7.0 /usr/local/awstats
  3. [root@www /]# cd /usr/local/awstats/tools/
  4. [root@www tools]# ./awstats_configure.pl
  1. ----- AWStats awstats_configure 1.0 (build 1.9) (c) Laurent Destailleur -----
  2. This tool will help you to configure AWStats to analyze statistics for
  3. one web server. You can try to use it to let it do all that is possible
  4. in AWStats setup, however following the step by step manual setup
  5. documentation (docs/index.html) is often a better idea. Above all if:
  6. - You are not an administrator user,
  7. - You want to analyze downloaded log files without web server,
  8. - You want to analyze mail or ftp log files instead of web log files,
  9. - You need to analyze load balanced servers log files,
  10. - You want to 'understand' all possible ways to use AWStats...
  11. Read the AWStats documentation (docs/index.html).
  12.  
  13. -----> Running OS detected: Linux, BSD or Unix
  14.  
  15. -----> Check for web server install
  16.  
  17. Enter full config file path of your Web server.
  18. Example: /etc/httpd/httpd.conf
  19. Example: /usr/local/apache2/conf/httpd.conf
  20. Example: c:\Program files\apache group\apache\conf\httpd.conf
  21. Config file path ('none' to skip web server setup):
  22. > /usr/local/httpd/conf/httpd.conf //httpd主配置文件路径
  23.  
  24. -----> Check and complete web server config file '/usr/local/httpd/conf/httpd.conf'
  25. Warning: You Apache config file contains directives to write 'common' log files
  26. This means that some features can't work (os, browsers and keywords detection).
  27. Do you want me to setup Apache to write 'combined' log files [y/N] ? y //设置日志文件类型
  28. Add 'Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"'
  29. Add 'Alias /awstatscss "/usr/local/awstats/wwwroot/css/"'
  30. Add 'Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"'
  31. Add 'ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"'
  32. Add '<Directory>' directive
  33. AWStats directives added to Apache config file.
  34.  
  35. -----> Update model config file '/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf'
  36. File awstats.model.conf updated.
  37.  
  38. -----> Need to create a new config file ?
  39. Do you want me to build a new AWStats config/profile
  40. file (required if first install) [y/N] ? y //设置站点配置文件
  41.  
  42. -----> Define config file name to create
  43. What is the name of your web site or profile analysis ?
  44. Example: www.mysite.com
  45. Example: demo
  46. Your web site, virtual server or profile name:
  47. > www.aaa.com //统计的站点名称
  48. 往后默认配置按回车

修改awstats.www.aaa.com.conf配置文件

  1. [root@www ~]# mkdir /var/lib/awstats
  2. [root@www ~]# vim /etc/awstats/awstats.www.aaa.com.conf
  1. LogFile="/usr/local/httpd/logs/access_log"
  2. DirData="/var/lib/awstats"

创建数据库的存放目录,并更新数据库

  1. oot@www ~]# /usr/local/awstats/tools/awstats_updateall.pl now //执行更新脚本
  2. Running '"/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -update -config=www.aaa.com -configdir="/etc/awstats"' to update config www.aaa.com
  3. Create/Update database for config "/etc/awstats/awstats.www.aaa.com.conf" by AWStats version 7.0 (build 1.971)
  4. From data in log file "/usr/local/httpd/logs/access_log"...
  5. Phase 1 : First bypass old records, searching new record...
  6. Searching new records from beginning of log file...
  7. Jumped lines in file: 0
  8. Parsed lines in file: 2
  9. Found 0 dropped records,
  10. Found 0 comments,
  11. Found 0 blank records,
  12. Found 2 corrupted records,
  13. Found 0 old records,
  14. Found 0 new qualified records.

创建周期性计划任务

  1. [root@www ~]# crontab -e
  2. */ * * * * /usr/local/awstats/tools/awstats_updateall.pl now

创建网站跳转页

  1. [root@www /] vim aws.html
  2. <html>
  3. <head>
  4. <meta http-equiv=refresh content="0;
  5. url=http://www.aaa.com/awstats/awstats.pl?config=www.aaa.com">
  6. </head>
  7. <body><body>
  8. </html>
  9. [root@www /]# mv aws.html /usr/local/httpd/htdocs/ //将跳转页移动到网站根目录下
  10. [root@www ~]# /etc/init.d/httpd restart
  11. 重启apache访问awstats主页

为AWSstats进行访问权限的控制

客户机地址限制

  1. [root@www /]# vim /usr/local/httpd/conf/httpd.conf
  2. <Directory "/usr/local/awstats/wwwroot">
  3. Options None
  4. AllowOverride None
  5. Order deny,allow
  6. Deny from 192.168.1.234 //拒绝IP为192.168.1.234的主机访问
  7. </Directory>
  8. [root@www /]# /etc/init.d/httpd restart

此时192.168.1.234客户机将无法访问www.aaa.com/aws.html

用户身份认证限制

首先使用htpasswd工具创建用户认证数据文件

  1. [root@www /]# htpasswd -c /usr/local/httpd/conf/.awspwd xuhao
  2. New password:
  3. Re-type new password:
  4. Adding password for user xuhao
  5. [root@www /]# cat /usr/local/httpd/conf/.awspwd
  6. xuhao:eE3EHFDzN4A5c
  7. 修改httpd.conf配置文件,添加用户授权
  8. [root@www /]# vim /usr/local/httpd/conf/httpd.conf
  9. <Directory "/usr/local/awstats/wwwroot">
  10. Options None
  11. AllowOverride None
  12. Order allow,deny
  13. Allow from all
  14. AuthName "AWStats Directory" //定义受保护的领域名称
  15. AuthType Basic //设置认证的类型
  16. AuthUserFile /usr/local/httpd/conf/.awspwd //设置用于保存用户账号、密码文件的路径
  17. require valid-user //合法用户才能访问
  18. </Directory>
  19. [root@www /]# /etc/init.d/httpd restart
  20. 登录客户端访问测试

astats日志分析系统的更多相关文章

  1. ELK_日志分析系统Logstash+ElasticSearch+Kibana4

    elk 日志分析系统 Logstash+ElasticSearch+Kibana4 logstash 管理日志和事件的工具 ElasticSearch 搜索 Kibana4 功能强大的数据显示客户端 ...

  2. [原创]ubuntu14.04部署ELK+redis日志分析系统

    ubuntu14.04部署ELK+redis日志分析系统 [环境] host1:172.17.0.4 搭建ELK+redis服务 host2:172.17.0.3 搭建logstash+nginx服务 ...

  3. Docker搭建ElasticSearch+Redis+Logstash+Filebeat日志分析系统

    一.系统的基本架构 在以前的博客中有介绍过在物理机上搭建ELK日志分析系统,有兴趣的朋友可以看一看-------------->>链接戳我<<.这篇博客将介绍如何使用Docke ...

  4. ELK + Filebeat 日志分析系统

    ELK + Filebeat 日志分析系统 架构图 环境 OS:CentOS 7.4 Filebeat: 6.3.2 Logstash: 6.3.2 Elasticsearch 6.3.2 Kiban ...

  5. AWStats日志分析系统

    1.什么是AWStats AWStats是一款功能强大且功能强大的免费工具,可以图形方式生成高级Web,流媒体,ftp或邮件服务器统计信息.此日志分析器用作CGI或命令行, 并在几个图形网页中显示您的 ...

  6. 苏宁基于Spark Streaming的实时日志分析系统实践 Spark Streaming 在数据平台日志解析功能的应用

    https://mp.weixin.qq.com/s/KPTM02-ICt72_7ZdRZIHBA 苏宁基于Spark Streaming的实时日志分析系统实践 原创: AI+落地实践 AI前线 20 ...

  7. Elasticsearch日志分析系统

    Elasticsearch日志分析系统 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.什么是Elasticsearch 一个采用Restful API标准的高扩展性的和高可用性 ...

  8. ELK日志分析系统简单部署

    1.传统日志分析系统: 日志主要包括系统日志.应用程序日志和安全日志.系统运维和开发人员可以通过日志了解服务器软硬件信息.检查配置过程中的错误及错误发生的原因.经常分析日志可以了解服务器的负荷,性能安 ...

  9. Rsyslog+ELK日志分析系统

    转自:https://www.cnblogs.com/itworks/p/7272740.html Rsyslog+ELK日志分析系统搭建总结1.0(测试环境) 因为工作需求,最近在搭建日志分析系统, ...

随机推荐

  1. 64位gcc编译32位汇编

    由于使用as和ld来编译链接汇编程序,在使用C库的时候比较麻烦,需要输入比较多的指令,所以使用gcc进行编译链接.由于书中内容是32位汇编程序,但是机器使用的是64位操作系统,自带的gcc也是64位的 ...

  2. VS2010单元测试

    编号:1016时间:2016年5月26日09:35:27功能:VS2010单元测试URL :http://blog.csdn.net/tjvictor/article/details/6175362

  3. Intellij IDEA 创建Web项目并在Tomcat中部署运行

      一.创建Web项目 1.File -> New Module,进入创建项目窗口 2.选择Java类型,在 Module name 处输入项目名,点击Next 3.勾选 Web Applica ...

  4. Mysql Too Many Connections问题解决

    MySQL的max_connections参数用来设置最大连接(用户)数.每个连接MySQL的用户均算作一个连接,max_connections的默认值为100.本文将讲解此参数的详细作用与性能影响. ...

  5. Java--继承和super关键字

    一.Java中方法的参数传递(重点) Java中参数传递都是值传递 Java中的值分两种: 1.如果传递的参数是基本数据类型: 传递的值就是基本数据类型的值. 传递的时候,其实是把基本数据类型的值,复 ...

  6. android 软键盘不遮挡页面上的控件

    只需要加android:windowSoftInputMode="adjustPan"就可以如: <activity android:name=".Enhance_ ...

  7. 最小二乘法 java

    import java.util.ArrayList; import java.util.Collection; import org.apache.commons.math3.optim.Point ...

  8. JavaWeb学习记录(三)——网页中文编码问题

    方法一: public void doGet(HttpServletRequest request, HttpServletResponse response)            throws S ...

  9. Android ——Handler相关

    layout文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:an ...

  10. UVA-11468 Substring(AC自动机+DP)

    题目大意:给一些模板串,一些字符的出现概率.问不会出现模板串的概率是多少. 题目分析:是比较简单的概率DP+AC自动机.利用全概率公式递推即可. 代码如下: # include<iostream ...