AWStats(强大的日志分析工具)安装笔记.docx_第1页
AWStats(强大的日志分析工具)安装笔记.docx_第2页
AWStats(强大的日志分析工具)安装笔记.docx_第3页
AWStats(强大的日志分析工具)安装笔记.docx_第4页
AWStats(强大的日志分析工具)安装笔记.docx_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

AWStats,强大的日志分析工具AWStats,强大的日志分析工具,本文原址/bbs/thread-902-1-1.html AWStats 是一个免费的强大而有个性的工具,带来先进的网络,流量,FTP或邮件服务器统计图. 本日志分析器作为CGI或从命令行在数个图形网页中显示你日志中包含的所有可能信息. 它利用一部分档案资料就能经常很快地处理大量日志档案, 它能分析日志文件来自从各大服务器工具 ,如 Apache日志档案 s (NCSA combined/XLF/ELF log format or common/CLF log format), WebStar, IIS (W3C的日志格式)及许多其他网站,Proxy(代理服务器)、Wap、流量服务器、邮件服务器和一些 FTP服务器.首先安装LAMP环境,这里不做介绍,请参考这篇文章!1、 APACHE的安装配置 Apache是世界使用排名第一的Web服务器,市场占有率达60%左右。 它的特点是简单、速度快、性能稳定。 它的成功之处主要在于它的源代码开放、有一支开放的开发队伍、支持跨平台的应用(可以运行在几乎所有的Unix、Windows、Linux系统平台上)、模块化结构以及它的可移植性等方面。# tar jxvf httpd-2.2.9.tar.bz2# cd httpd-2.2.9# ./configure -prefix=/usr/local/www -enable-so -enable-rewrite # make & make install# vi /usr/local/www/conf/httpd.conf找到DocumentRoot “/usr/local/apache/htdocs”修改为:DocumentRoot “/var/www”(后文中我们还会注释掉此行,以启用虚拟主机)找到修改为:找到 Options FollowSymLinks AllowOverride None Order deny,allow Deny from all /这句改为Allow from all# mkdir /var/www# /usr/local/www/bin/apachectl start添加到自启动# cp /usr/local/www/bin/apachectl /etc/rc.d/init.d/httpd然后 vi /etc/rc.d/init.d/httpd 添加(#!/bin/sh下面)# chkconfig: 2345 10 90# description: Activates/Deactivates Apache Web Server最后,运行chkconfig把Apache添加到系统的启动服务组里面:# chkconfig -add httpd# chkconfig httpd on测试apache是否正常启动可以通过ps aux | grep httpd查看httpd进程是否存在,也可以通过netstat -an | grep 80查看。2、 Mysql的安装配置MySQL是一个开放源码的关系型数据库管理系统,开发者为瑞典MySQL AB公司。目前MySQL被广泛地应用在Internet上的中小型网站中。由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,许多中小型网站为了降低网站总体拥有成本而选择了MySQL作为网站数据库。# tar -zxvf mysql-5.0.67.tar.gz # cd mysql-5.0.67# groupadd mysql# useradd -g mysql -s /sbin/nologin -M mysql# ./configure -prefix=/usr/local/mysql -with-charset=gbk -with-extra-charset=all -enable-thread-safe-client -enable-local-infile -with-low-memory # make & make install# cp support-files/f/etc/f# chown -R mysql.mysql /usr/local/mysql/# /usr/local/mysql/bin/mysql_install_db -user=mysql# chown -R root.root /usr/local/mysql/# chown -R mysql.mysql /usr/local/mysql/var/启动数据库服务,并添加到自启动# /usr/local/mysql/bin/mysqld_safe -user=mysql &# cp support-files/mysql.server/etc/rc.d/init.d/mysqld# chmod 755 /etc/rc.d/init.d/mysqld加入自动启动服务队列:# chkconfig -add mysqld# chkconfig-level345mysqldon添加root密码# /usr/local/mysql/bin/mysqladmin -u root password 123456测试一下:# /usr/local/mysql/bin/mysql -u root -p输入密码:123456,看能不能进入到数据库3、安装PHP PHP,一个嵌套的缩写名称,是英文超级文本预处理语言(PHP:Hypertext Preprocessor)的缩写。PHP 是一种在服务器端执行的嵌入HTML文档的脚本语言,语言的风格有类似于C语言,现在被很多的网站编程人员广泛的运用。PHP 独特的语法混合了 C、Java、Perl 以及 PHP 自创新的语法。它可以比 CGI 或者 Perl 更快速的执行动态网页。用PHP做出的动态页面与其他的编程语言相比,PHP是将程序嵌入到HTML文档中去执行,执行效率比完全生成HTML标记的 CGI要高许多;与同样是嵌入HTML文档的脚本语言JavaScript相比,PHP在服务器端执行,充分利用了服务器的性能;PHP执行引擎还会将用户经常访问的PHP程序驻留在内存中,其他用户再一次访问这个程序时就不需要重新编译程序了,只要直接执行内存中的代码就可以了,这也是PHP高效率的体现之一。PHP具有非常强大的功能,所有的CGI或者JavaScript的功能PHP都能实现,而且支持几乎所有流行的数据库以及操作系统。# tar -zxvf php-5.2.6.tar.gz # cd php-5.2.6# ./configure -prefix=/usr/local/php -with-apxs2=/usr/local/www/bin/apxs -with-mysql=/usr/local/mysql/ -with-mysqli=/usr/local/mysql/bin/mysql_config -with-config-file-path=/usr/local/php -with-zlib -enable-mbstring=all # make & make install# cp php.ini-dist /usr/local/php/php.ini# vi /usr/local/www/conf/httpd.conf添加一句AddType application/x-httpd-php .php .phtml找到DirectoryIndex index.html在后面添加index.php别忘了重启一下apache服务!4、测试环境是否搭建成功# vi /var/www/tesp.php然后在浏览器中输入http:/IP,看看能否正常显示至此,LAMP环境已经成功搭建!祝你成功!下面开始安装AWstats1、安装cronolog,日志截取工具下载地址:/# tar -zxvf cronolog-1.6.2.tar.gz# cd cronolog-1.6.2# ./configure# make# make install2、安装awstats下载地址:/#DOWNLOAD# tar -zxvf awstats-6.8.tar.gz# mv awstats-6.8 /usr/local/awstats# cd /usr/local/awstats/# ls -ldocs是一些html格式到文档,里面有安装和使用到方法;README.TXT是软件到介绍和权利申明等;tools文件夹里面是一些脚本和配置文件,比如批量update的脚本、转换静态html文件的脚本、httpd.conf的配置文件等;wwwroot文件夹里面的东西才是最重要的,下面详细介绍:wwwroot里面又有4个文件夹:awstats、css、js、icon、和classes。从我的使用情况上看,有用的只有awstats和icon 文件夹。如果你是自己的服务器,自己能控制apache的服务的配置文件,那么你可以使用tools/awstats_configure.pl脚本来进行安装。你只需要指出httpd.conf的位置即可# perl tools/awstats_configure.pl-> Running OS detected: Linux, BSD or Unix-> Check for web server installFound Web server Apache config file /usr/local/apache/conf/httpd.conf-> Check and complete web server config file /usr/local/apache/conf/httpd.confWarning: You Apache config file contains directives to write common log filesThis means that some features cant work (os, browsers and keywords detection).Do you want me to setup Apache to write combined log files y/N ? 输入yAdd 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> directiveAWStats directives added to Apache config file.-> Update model config file /usr/local/awstats/wwwroot/cgi-bin/awstats.model.confFile awstats.model.conf updated.-> Need to create a new config file ?Do you want me to build a new AWStats config/profilefile (required if first install) y/N ? 输入y-> Define config file name to createWhat is the name of your web site or profile analysis ?Example: Example: demoYour web site, virtual server or profile name:> 输入你的域名然后就一直回车就行了3、截取apache日志例:cronolog命令在/usr/sbin/cronolog下,日志文件在/usr/local/apache/logs/下把CustomLog logs/access_log combined修改为CustomLog |/usr/local/sbin/cronolog /usr/local/apache/logs/access_log.%Y%m%d combinedErrorLog |usr/local/apache/logs/error_log.%Y%m%d如果有虚拟主机,虚拟主机也要配置,例如:<virtualHost *:80>ServerName CustomLog |/usr/local/sbin/cronolog /usr/local/apache/logs/access_log.%Y%m%d combinedErrorLog |usr/local/apache/logs/error_log.%Y%m%d</VirtualHost>重启apache# /usr/local/apache/bin/apachectl restart创建/var/lib/awstats目录用来存放分析结果,并将所有权给apache用户(apache用户需要有写权限)# mkdir /var/lib/awstats# chmod a+w /var/lib/awstats修改配置文件# vi /etc/awstats/awstats.你的域名.conf把LogFile=/var/log/httpd/mylog.log修改为LogFile=/usr/local/apache/logs/access_log.%YYYY%MM%DD%YYYY-24 表示24小时之前的年份,%MM-24表示24小时之前的月份,%DD-24表示24小时之前的天,合起来%YYYY-24%MM-24%DD-24就表示24小时前的年月日。为什么要减去一个24呢,这是因为我们在使用awstats分析apache日志的时候,必须分析已经生成的日志。而我们又常常使用cron来自动update,举个例子,当我们于 2007年5月1日凌晨1点分析我们网站的apahce日志的时候,我们是要分析前一天也就是2007年4月30日的日志,而不是cron运行的当天5月 1日的日志,这样,减去一个数字,才能够正确得到我们想要分析的apche的日志的文件名。当然,你也可以不用24这个数字,可以根据自己的实际情况来调整.AllowToUpdateStatsFromBrowser=1 主页上有手动“立即更新”按钮,默认为0,不出现 4、安装国家和城市插件分别下载插件程序:GeoIP:/download/geoip/api/c//download/geoip/api/perl/GeoIP安装:先下载C库:GeoIP C解包后# tar -zxvf GeoIP-1.4.5.tar.gz# cd GeoIP-1.4.5# ./configure# make# make install然后下载Perl库:GeoIP Perl解包后# tar -zxvf Geo-IP-1.36.tar.gz# cd Geo-IP-1.36# perl MakeFile.PL# make# make install再下载GeoIP/GeoIPCityLite两个信息数据包:/download/geoip/database//download/geoip/database/GeoLiteCountry/# gzip -d GeoLiteCity.dat.gz# cp GeoLiteCity.dat /etc/awstats/# gzip -d GeoIP.gz# cp GeoIP /etc/awstats/#vi /etc/awstats/awstats.你的域名.conf修改其中的一些配置选项为:LoadPlugin=decodeutfkeysLoadPlugin=geoip GEOIP_STANDARD /etc/awstats/GeoIP LoadPlugin=geoip_city_maxmind GEOIP_STANDARD /etc/awstats/GeoLiteCity.dat如果出现无法调用.so文件或者其他共享文件错误编辑/etc/ld.so.conf,在其中加入一行/usr/local/lib之后再执行/sbin/ldconfig /etc/ld.so.conf5、启动awstats手动生成日志分析文件#/usr/local/awstats/tools/awstats_updateall.pl now自动生成日志分析文件在crond加入#crontab -e添加:*/5 * * * * root /usr/local/awstats/tools/awstats_updateall.pl now (每5分钟更新日志分析文件) 通过web查看日志http:/你的域名/awstats/awstats.pl?config=你的域名6、为日志设置密码 AuthType Basic AuthName awstat access AuthUserFile /etc/awstats/htpasswd Require valid-user注意:Basic方式密码是用过明文传输,如果想通过加密的方式传输密码,请用Digest方式。# /usr/local/apache/bin/htpasswd -c /etc/awstats/htpasswd admin连续两次输入密码,这样就生成了用户名和密码,下次在访问的时候就需要输入密码了。注意:如果增加一个用户不要加-c参数7、安装qqhostinfo插件awstats是可以增加插件的。爱.EASY.RELOADED做的这个qqhostinfo插件,可以在访问主机表格中增加一列,显示ip对应的位置。当然这个资料来源于著名的QQWry.Dat文件。插件代码:下载并复制

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论