awstats 配置「建议收藏」

awstats 配置「建议收藏」awstats一、首先修改httpd.conf  httpd-vhost.conf把log模式由common改成combinedvi/usr/local/apache2/conf/httpd.confvi/usr/local/apache2/conf/extra/httpd-vhost.conf/usr/local/apache2/bin/apachectlrestart二、安装Geo-…

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

awstats
一、首先修改httpd.conf   httpd-vhost.conf
把log模式由common改成combined
vi /usr/local/apache2/conf/httpd.conf
vi /usr/local/apache2/conf/extra/httpd-vhost.conf
/usr/local/apache2/bin/apachectl restart

二、安装Geo-IP
wget  
http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.3.tar.gz

wget
http://www.maxmind.com/download/geoip/api/perl/Geo-IP-1.30.tar.gz

wget  
http://search.cpan.org/CPAN/authors/id/G/GM/GMPASSOS/Geo-IPfree-0.2.tar.gz

cd /usr/local/src

tar zxvf GeoIP-1.4.3.tar.gzcdGeoIP-1.4.3./configuremakemake install tar zxvf Geo-IP-1.30.tar.gzcdGeo-IP-1.30perl Makefile.PLmakemake install
tar zxvf Geo-IPfree-0.2.tar.gzcd Geo-IPfree-0.2perlMakefile.PLmakemake install

三、安装awstats
1、下载并安装
wget  
http://downloads.sourceforge.net/awstats/awstats-6.7.tar.gz

tar zxvf awstats-6.7.tar.gz
mv awstats-6.7 /usr/local/awstats
cd /usr/local/awstats
cd /usr/local/awstats/tools
perl awstats_configure.pl

2、配置
vi /etc/awstats/awstats.www.web.cn.conf
DirData=”/usr/local/apache2/htdocs/awstats/data”
DirIcons=”/awstats/icon”
DirCgi=”/usr/local/apache2/cgi-bin/awstats”
LogFile=”/usr/local/apache2/logs/www.web.cn-access_log”

(1)多日志合并分析(例:新浪播客其中两台服务器2月6日的日志30.0206.vblog.log与31.0206.vblog.log)
LogFile=”/opt/awstats/tools/logresolvemerge.pl/var/apachelogs/30.0206.vblog.log /var/apachelogs/31.0206.vblog.log|”

LogFile=”/opt/awstats/tools/logresolvemerge.pl/var/apachelogs/*.0206.vblog.log|”
SiteDomain=
www.web.cn

HostAliases=
www.web.cn

AllowToUpdateStatsFromBrowser=1
Lang=”cn”
LoadPlugin=”decodutfkeys”
LoadPlugin=”geoip GEOIP_STANDARD/usr/local/share/GeoIP/GeoIP.dat”
#LoadPlugin=”geoipfree”
#LoadPlugin=”geoip_city_maxmind GEOIP_STANDARD/usr/local/share/GeoIP/GeoLiteCity.dat”

注释:GeoIP.dat 跟geoipfree2者只能选一个,不能同时使用的!我选的是GeoIP.dat
加了GeoLiteCity.dat 貌似有反向的解析,整体的awstats会变慢。所以实验了一下,实际的应用不建议使用!
同时经过实际的测试geoipfree2的准确性太差,把国内的地址认为是美国的,所以还是使用GeoIP吧。

3、拷贝cgi、data、icon
cp -r /usr/local/awstats/wwwroot/cgi-bin//usr/local/apache2/cgi-bin/awstats
mkdir -p /usr/local/apache2/htdocs/awstats/data
chmod 777 /usr/local/apache2/htdocs/awstats/data
cp -r /usr/local/awstats/wwwroot/icon//usr/local/apache2/htdocs/web/awstats/icon

/usr/local/apache2/bin/apachectl restart

/usr/local/apache2/cgi-bin/awstats/awstats.pl -update-config=www.web.cn
在浏览器中打开以下网站

http://www.web.cn/cgi-bin/awstats/awstats.pl?config=www.web.cn

注释:
LogFile (APCHE CustomLog日志的绝对路径)DirData  (指定AWSTATS生成数据的存放目录,可以任意指定,但注意目录要具有读写权限,可以设置为777或755)DirCgi  (cgi的路径,是相对于网站根目录的绝对路径,我这里没有指定网站根目录是因为apache的配置默认有cgi-bin的缺省目录,我是拷贝到这个缺省目录中的)DirIcons  (icon的路径,是相对于网站根目录的绝对路径,这个就没办法了,只能放到每个要设定的虚拟域名网站的目录中了)SiteDomain (输入你的域名)HostAliases (主机别名,如果还有其他的二级域名或三级域名,请在此添加。)AllowToUpdateStatsFromBrowser (是否允许用户从浏览器中实时更新统计,这个功能在测试的时候很有用!)Lang=”cn”(设置网页显示语言为简体中文。)

更新Geo-IP的2个免费数据库
mkdir -p /home/soft/awstats
cd /home/soft/awstats
wget
http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

wget
http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz

gunzip GeoLiteCity.dat.gz
gunzip GeoIP.dat.gz
cp GeoLiteCity.dat /usr/local/share/GeoIP/
cp GeoIP.dat /usr/local/share/GeoIP/

cd /usr/local/share/GeoIP

测试AWSTATS
/usr/local/apache2/cgi-bin/awstats/awstats.pl -update-config=www.web.cn

如果不出现错误信息并且得到统计数据回显则成功!
访问地址:
http://www.web.cn/cgi-bin/awstats/awstats.pl?config=www.web.cn

设置crondcrontab -e增加:(可设置为每天零时进行更新)00 * * * /usr/local/apache2/cgi-bin/awstats/awstats.pl -update-config=www.web.cn

修改httpd.conf设置/usr/local/apache2/cgi-bin/awstats目录访问权限
这样就可以通过用户名和密码来限制可以访问的计算机了

vi /usr/local/apache2/conf/httpd.conf

/usr/local/apache2/cgi-bin/awstats“>
AllowOverride authconfig
Order allow,deny
Allow from all

vi /usr/local/apache2/htdocs/cgi-bin/awstats/.htaccess
AuthType Basic
AuthName “请输入用户名和密码”
AuthUserFile /usr/local/apache2/
cgi-bin/awstats/passwords
Require valid-user
htpasswd -c /usr/local/apache2/
cgi-bin/awstats/passwordsadminsarg
重复输入2次密码

/usr/local/apache2/bin/apachectl restart

完工!

注释:perl awstats_configure.pl的过程
—– AWStats awstats_configure 1.0 (build 1.7) (c) Laurent Destailleur—–
This tool will help you to configure AWStats to analyze statistics for
one web server. You cantry 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
  Found Web server Apache config file’/usr/local/apache2/conf/httpd.conf’

—–> Check and complete web server config file’/usr/local/apache2/conf/httpd.conf’

—–> 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:
>
www.web.cn

—–> Define config file path
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):
>

—–> Create config file ‘/etc/awstats/awstats.www.web.cn.conf’
Config file /etc/awstats/awstats.www.web.cn.conf created.

—–> 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=www.web.cn
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.www.web.cn.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for ‘www.web.cn’ with command:
> perl awstats.pl -update -config=www.web.cn
You can also read your statistics for ‘www.web.cn’ with URL:
>
http://localhost/awstats/awstats.pl?config=www.web.cn

Press ENTER to finish…

注释:
www.web.cn
是借用的,不是真的,是举个例子的!

 

注释:  当AllowToUpdateStatsFromBrowser (是否允许用户从浏览器中实时更新统计,这个功能在测试的时候很有用!)=1时 When this parameter is set to 1, AWStatsadds a button on report page toallow to “update” statistics from aweb browser. Warning, when “update” ismade from a browser, AWStats isrun as a CGI by the web server user definedin your web server (user”nobody” by default with Apache, “IUSR_XXX” withIIS), sothe “DirData” directory and all already existing historyfilesawstatsMMYYYY[.xxx].txt must be writable by this user. Change permissionsifnecessary to “Read/Write” (and “Modify” for Windows NTFSfile systems).

当这个参数设置为1,AWStats添加一个按钮toallow报告页更新统计一个浏览器。警告,更新”ismade从一个浏览器,AWStats运行CGI的作为一个网络服务器的用户definedin你的网络服务器(默认用户没有人“IUSR_XXX”withIIS鞍鞯,制作出),因此这种“DirData”目录和所有已存在的历史filesawstatsMMYYYY[xxx]txt必须可写的这个用户。改变权限ifnecessary“/”(“修改对于Windows NTFS文件系统)。修改DirData权限777

安装qq纯真库。

3个文件复制到cgi-bin/awstats/plugins/

修改qqhostinfo文件

require”/usr/local/apache2/cgi-bin/awstats/plugins/qqwry.pl”;

修改qqwry.pl

my$ipfile=”/usr/local/apache2/cgi-bin/awstats/plugins/QQWry.Dat”;(注意dat是大写还是小写)

修改/etc/awstats/awstats.xkyx.com

加上LoadPlugin=”qqhostinfo”

修改LoadPlugin=”decodeutfkeys”

LoadPlugin=”tooltips”

LoadPlugin=”hashfiles”

LoadPlugin=”geoipGEOIP_STANDARD /usr/local/share/GeoIP/GeoIP.dat”(可选是否删除在国际栏显示区别)

 

Update就行了显示在国家Location

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

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

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


相关推荐

  • pycharm 2021.4.14激活码失效_通用破解码「建议收藏」

    pycharm 2021.4.14激活码失效_通用破解码,https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月17日
    54
  • c++入门教程–-7嵌套循环

    c++入门教程–-7嵌套循环

    2021年3月12日
    156
  • java栈内存初始化,阿里面试官:小伙子,你给我说一下JVM对象创建与内存分配机制吧…

    java栈内存初始化,阿里面试官:小伙子,你给我说一下JVM对象创建与内存分配机制吧…内存分配机制逐步分析类加载检查:虚拟机遇到一条new指令(new关键字、对象的克隆、对象的序列化等)时,会先去检查这个指令的参数在常量池中定位到一个类的符号引用,并且这个符号引用代表的类是否应被加载过,如果没有那么就去加载该类分配内存类加载完毕后会给对象分配内存空间。对象的所需的内存大小在类加载完毕后就便可完全确认,为对象分配内存大小的空间等同于把一块确定大小的内存从java堆中划分出来。如何划分…

    2022年5月14日
    38
  • manifest文件使用(manifest文件作用)

    解决难以打开MANIFEST文件的问题打开MANIFEST文件的麻烦MicrosoftNotepad已删除你尝试加载MANIFEST文件并收到错误,例如“%%os%%无法打开MANIFEST文件扩展名”。通常情况下,这意味着MicrosoftNotepad没有安装在%%os%%上。由于您的操作系统不知道如何处理此文件,因此无法通过双击将其打开。提示:如果你…

    2022年4月11日
    182
  • pycharm安装包出现错误

    pycharm安装包出现错误提示:Youshouldconsiderupgradingviathe’e:\programfiles\python37\python.exe-mpipinstall–upgradepip’command.这一类问题,其实就是你的pip版本低了,只需要输入命令python-mpipinstall–upgradepip升级即可。

    2022年5月13日
    46
  • 如何使用串口调试助手(调试串口)

    如何使用串口调试助手(调试串口)转载自:https://jingyan.baidu.com/article/54b6b9c0b3c8c02d583b4707.html如何使用串口调试助手(调试串口)很多时候,调试硬件需要用串口输出一些调试信息,用电脑USB口接收十分方便,串口调试软件很多,用习惯了还是觉得串口调试助手最为方便,这个也是因人而异吧,接下来带大家了解一下串口调试助手如何使用。工具/原料 windows电脑一台 USB接口线一根(用于连接硬件和电脑USB接口) 方法/步骤 1 下载.

    2022年6月9日
    71

发表回复

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

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