awstats安装流程「建议收藏」

awstats安装流程「建议收藏」我是直接从网站上下的rpm,然后rpm-ivh的然后直接安装到/usr/local/awstatsapache日志格式要使用combined:CustomLog"/var/log/httpd/access_log"combined我是用的logrotate每天断日志,然后将以前的日志打包成gz存放,于是昨天的日志就是access_log.1.gz添加主机(可以…

大家好,又见面了,我是你们的朋友全栈君。

我是直接从网站上下的rpm,然后rpm -ivh的
然后直接安装到/usr/local/awstats
apache

日志格式要使用combined:

CustomLog ” /var/log/httpd/access_log” combined

我是用的logrotate每天断日志,然后将以前的日志打包成gz存放,于是昨天的日志就是access_log.1.gz

添加主机(可以添加多个):

cd /usr/local/awstats/tools
perl awstats_configure.pl

Config file path (‘none’ to skip web server setup):
> /etc/httpd/conf/httpd.conf

Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y

Your web site, virtual server or profile name:
> www.funbsd.net

Directory path to store config file(s) (Enter for default):
> /usr/local/etc/awstats

修改主机配置(/usr/local/etc/awstats/awstats.www.funbsd.net.conf),与httpd.conf保持一致:

#LogFile=”gzip -d < log.gz |”
#LogFile=”awstats/tools/logresolvemerge.pl *.log |”
LogFile=”gzip -d < /var/log/httpd/access_log.1.gz |”
LogType=W
LogFormat=1
SiteDomain=”www.funbsd.net”
HostAliases=”funbsd.net www.funbsd.net 192.168.0.100″
DNSLookup=2

DirData=”/var/lib/awstats“[这里我用的awstats目录里的data]
AllowToUpdateStatsFromBrowser=0
CreateDirDataIfNotExists=0
SaveDatabaseFilesWithPermissionsForEveryone=0
PurgeLogFile=0
ArchiveLogRecords=0
KeepBackupOfHistoricFiles=1

DefaultFile=”index.htm index.html index.php”
SkipHosts=”localhost REGEX[^192\.168\.]”
SkipFiles=”REGEX[^\/images] REGEX[^\/css] REGEX[^\/scripts] REGEX[^\/awstats] REGEX[^*\.gif]”
Lang=”auto”

#LoadPlugin=”decodeutfkeys”
#LoadPlugin=”hashfiles”
#LoadPlugin=”geoip GEOIP_STANDARD”
#LoadPlugin=”userinfo”
#LoadPlugin=”hostinfo”

#Include “”

安装过程会自动在httpd.conf文件中添加下面的配置信息:

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/”
<Directory “/usr/local/awstats/wwwroot”>
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>

将缺省awstats.model.conf 命名成common.conf
修改其中的
LoadPlugin=”decodeutfkeys”

重启Apache:

/usr/sbin/apachectl restart

统计旧的主机日志:

mkdir -p /var/lib/
awstats [我配的就是/usr/local]

/usr/local/
awstats/wwwroot/cgi-bin/
awstats.pl -config=www.funbsd.net \

-update -Logfile=/var/log/httpd/www.funbsd.net.log[这里我的情况不同]

我直接:
/usr/local/awstats/tools/awstats_updateall.pl now -update -config=tdrd.org

定时统计所有主机日志:

0 * * * * /usr/local/
awstats/tools/
awstats_updateall.pl now -configdir=/usr/local/etc/
awstats > /dev/null 2>&1
这里我的配置文件目录是/etc/awstats/
所以我的应该是10 8 * * * /usr/local/
awstats/tools/
awstats_updateall.pl now -update -config=tdrd.org > /dev/null 2>&1

测试:

我的是tdrd.org/awstats/awstats.pl?config=tdrd.org

plugin

awstats支持插件功能,以GeoIP为例:

网址:http://www.maxmind.com/app/perl?rId=awstats

cd /home/pkg
fetch http://www.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
tar zxvf GeoIP.tar.gz
cd GeoIP-*; ./configure; make; make install

cd /home/pkg
fetch http://www.maxmind.com/download/geoip/api/perl/Geo-IP-1.27.tar.gz
tar zxvf Geo-IP-*.tar.gz
cd Geo-IP-*; perl Makefile.PL; make; make install

定时更新GeoIP库:

MAILTO=postmaster@funbsd.net
0 0 * * 0 cd /usr/local/share/GeoIP/ && fetch http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz && gunzip -f GeoIP.dat.gz

也可以从pkg安装各插件(参考配置文件PLUGINS一节):

pkg_add -r p5-URI.tbz
pkg_add -r p5-Encode-HanConvert.tbz
pkg_add -r p5-Storable.tbz
pkg_add -r GeoIP.tbz
pkg_add -r p5-Geo-IP.tbz
pkg_add -r p5-Net-XWhois.tbz

加载插件(/usr/local/etc/awstats/awstats.www.funbsd.net.conf):

LoadPlugin=”decodeutfkeys”
LoadPlugin=”hashfiles”
LoadPlugin=”geoip GEOIP_STANDARD”
LoadPlugin=”hostinfo”

我这里不能LoadPlugin=”hostinfo”因为有东西没装上去

Error: Plugin load for plugin ‘hostinfo’ failed with return code: Error: Can’t locate Net/XWhois.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 . /usr/local/awstats/wwwroot/cgi-bin/lib /usr/local/awstats/wwwroot/cgi-bin/plugins /usr/local/awstats/wwwroot/cgi-bin/plugins) at (eval 5) line 1.

Setup (‘/etc/awstats/awstats.tdrd.org.conf’ file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in ‘docs’ directory

后面又装了个qqhostinfo,用纯真数据库qqwry.dat来查ip比较符合中国现状

http://www.ieasy.org/reload/cat2/awstats_qqhosti.html

1。首先,点击这里qqhostinfo.pm下载插件。把它放在awstats/wwwroot/cgi-bin/plugins中。

2.下载上一篇blog提到的分析QQWry.dat的perl脚本。qqwry.pl放在同一目录。

3。去网上下载QQWry.Dat放在同一目录中,注意文件名一定要是QQWry.Dat

4。编辑你得awstats配置文件,大概在LoadPlugin=”hostinfo”的后面增加一行

LoadPlugin="qqhostinfo"
但是qqwry.pl要改一下把其中dat的地方改成绝对路径
+++++++++++++++++++
apache 限制访问
htpasswd -c /var/www/htpasswd/awstats heater

htpasswd /var/www/htpasswd/awstats ruc

改http.conf

在最后面那个<Directory “/usr/local/awstats/wwwroot”>

加上

AuthType Basic

AuthName “Restricted Files”

AuthUserFile /var/www/htpasswd/awstats

Require valid-user
然后/usr/sbin/apachectl restart
+++++++++++++++++++++++++++++=
执行命令/usr/local/awstats/tools/awstats_updateall.pl now

-configdir=/etc/awstats
不过貌似得root执行?

每天定时执行就好
=======================================================================
相关资料的网页
AWStats: Apache/IIS的日志分析工具

——在GNU/Linux和Windows平台上的使用简介
http://www.chedong.com/tech/awstats.html
Web服务器日志统计分析完全解决方案
http://hi.baidu.com/yaobodi/blog/item/1d1e8913b962c6d0f6039e5d.html
AWStats 中文官方网站

获得先进统计表的免费的实时日志文档分析器.
http://www.awstats.cn/
http://sourceforge.net/projects/awstats/
=======================================================================
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/160212.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 怎么用python打开csv文件_Python文本处理之csv-csv文件怎么打开[通俗易懂]

    怎么用python打开csv文件_Python文本处理之csv-csv文件怎么打开[通俗易懂]csv英文全称是Comma-SeparatedValue,字面翻译逗号分隔值,是一种常见的文本格式文档,可用Excel打开,也可用常见的文本编辑器打开。csv文件经常用于在电子表格软件和纯文本之间交互数据。Python内置了csv模块,可以很方便的操作csv文件。下面介绍两种读写csv文件的方法。一、通过reader和writer函数先看一段简单的示例代码:text包含两个列表元素,首先把这两行…

    2022年7月21日
    41
  • js常用跳转代码[通俗易懂]

    js常用跳转代码[通俗易懂]今天整理下我们常用的js跳转代码,常用的js跳转代码比如:js倒计时跳转代码、pc站跳转手机站代码、在原来的窗体中直接js跳转用、在新窗体中打开页面用、js直接跳转代码、js返回代码、head标签内加如下代码实现页面定时自动跳转代码、self.location方式实现页面跳转、top.loca…

    2022年8月13日
    3
  • 中间件

    我们在开发中经常会遇到判断用户是否登录,把没有登录的用户请求跳转到登录页面。我们通常会通过给几个特定视图函数加装饰器实现了这个需求。但是以后添加的视图函数能也需要加上装饰器,这样是不是稍微有点繁琐;

    2022年3月29日
    36
  • AssertValid函数学习

    AssertValid函数学习转自http://tsitao.blog.163.com/blog/static/29795822006914105840496/VC的调试中,AssertValid和Dump函数的应用CObject

    2022年7月1日
    19
  • 个人开发者app消息推送简单实现思路

    个人开发者app消息推送简单实现思路最近新做了一个app,中午没事大脑在简单的思索者。。假如:我的这个app很火,用的人会很多,那么它就成了我的一个个人平台。如果我想让给广大用户推送一个新消息,该怎么办?当然你可以百度搜服务器消息推送实现之类的。但是软而一想,能不能通过一个简单方法实现呢。我想应该是有的。前期准备:1.首先我们花几十元注册个域名2.购买个便宜的主机,网上有一年几十元的那种3.将域名解析

    2022年5月11日
    42
  • 洛谷P1201 [USACO1.1]贪婪的送礼者Greedy Gift Givers

    洛谷P1201 [USACO1.1]贪婪的送礼者Greedy Gift Givers

    2021年9月17日
    47

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号