—— 参考IBM文章:THIS , 不一样的指导顺序 ——

1. awstats分析nginx - access.log,网上资料大部分都是下载,然后配置。官网下载地址:

http://awstats.sourceforge.net/#DOWNLOAD

cd /usr/local

wget http://prdownloads.sourceforge.net/awstats/awstats-7.2.zip

unzip awstats-7.2.zip

mv awstats-7.2 awstats

sudo chown -R root:root awstats        # 注意权限,否则会影响以后执行

2. 安装好了,配置:

cd /usr/local/awstats/tools

sudo chmod 711 awstats_configure.pl    #把awstats_configure.pl  权限修改与 awstats_buildstaticpages.pl 相同

sudo ./awstats_configure.pl

然后就是“向导 一”:

----- AWStats awstats_configure 1.0 (build 1.9) (c) Laurent Destailleur -----
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try 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

Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
> none        # 这里要输入,完整的,你使用的服务器的 配置文件,但是 我们用的是nginx,不支持,那就 none,跳过

然后,“向导 二”

Your web server config file(s) could not be found.
You will need to setup your web server manually to declare AWStats
script as a CGI, if you want to build reports dynamically.
See AWStats setup documentation (file docs/index.html)

-----> 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:
> lengxiaohua.com        # 你的网站域名

“四”:

-----> 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):
> # 默认配置文件路径

"五" - 得到关键的 执行命令:

-----> 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=lengxiaohua.com
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...

命令-----> /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=lengxiaohua.com

"六" - 配置文件路径:

A SIMPLE config file has been created: /etc/awstats/awstats.lengxiaohua.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'lengxiaohua.com' with command:
> perl awstats.pl -update -config=lengxiaohua.com
You can also build static report pages for 'lengxiaohua.com' with command:
> perl awstats.pl -output=pagetype -config=lengxiaohua.com

Press ENTER to finish...

路径 ----> /etc/awstats/awstats.lengxiaohua.com.conf

完成。

3. 修改调整配置:

路径 ----> /etc/awstats/awstats.lengxiaohua.com.conf

vim /etc/awstats/awstats.lengxiaohua.com.conf

 

修改:LogFile="/var/log/httpd/mylog.log"

变为:LogFile="/var/log/nginx/access_%YYYY-0%MM-0%DD-0.log"        # 察看 vim /etc/nginx/nginx.conf,可以知道 access.log路径

4. 执行(手动)统计:

执行  :  命令-----> /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=lengxiaohua.com

(本地 - 自己:执行  :  命令-----> /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.lengxiaohua.com)

错误:

Error: AWStats database directory defined in config file by 'DirData' parameter (/var/lib/awstats) does not exist or is not writable.
Setup ('/etc/awstats/awstats.lengxiaohua.com.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

试试: sudo apt-get install awstats

然后基本执行成功了,可能需要重启?或者其他操作

3. webroot 目录 ,这是什么?

就是指,nginx配置中,你的 虚拟服务器 指向的 静态文件 的路径。

因为 awstats 也是生成的 静态文件,所以,nginx只要能访问到这个静态文件,就可以了。【此处百度,“nginx 静态文件” - 可以有答案】

我的nginx指向的静态文件路径是:

/opt/test/html

4. 生成静态页面(能看到生成了一系列的文件,此时就是成功了):

/usr/local/awstats/tools/awstats_buildstaticpages.pl -update  \
-config=www.lengxiaohua.com -lang=cn -dir=/opt/lengxiaohua/web/html/awstats \
-awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl

5. 设置 定时任务,这样让每天都自动生成 静态页面:

Nginx & AWStats 安装、配置、使用的更多相关文章

  1. nginx初级安装配置

    nginx初级安装配置 转自:(lykyl原创)http://www.cnblogs.com/lykyl/archive/2012/11/21/2781077.html 实验环境:系统 CENTOS5 ...

  2. nginx+tomcat安装配置

    nginx+tomcat安装配置 # nginx+tomcat安装配置 #创建网站目录 mkdir -p /www/wwwroot cd /www #安装配置 wget http://mirrors. ...

  3. gerrit+nginx+centos安装配置

    安装环境 centos 6.8 gerrit-full-2.5.2.war 下载地址:https://gerrit-releases.storage.googleapis.com/gerrit-ful ...

  4. Nginx的安装配置和tomcat负载均衡

    Nginx简介 什么是nginx? Nginx是一款高性能的http 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器.由俄罗斯的程序设计师Igor Sysoev所开发,官方测试ngi ...

  5. Nginx+nagios安装配置

    Nginx+nagios安装配置 [root@Nagios ~]# vi /etc/nginx/nginx.conf server { listen ; server_name localhost; ...

  6. nginx php-fpm安装配置 CentOS编译安装php7.2

    CentOS编译安装php7.2 介绍: 久闻php7的速度以及性能那可是比php5系列的任何一版本都要快,具体性能有多好,建议还是先尝试下再说.如果你是升级或新安装,那你首先需要考虑php7和程序是 ...

  7. 吴裕雄--天生自然Django框架开发笔记:Django Nginx+uwsgi 安装配置

    Django Nginx+uwsgi 安装配置 使用 python manage.py runserver 来运行服务器.这只适用测试环境中使用. 正式发布的服务,需要一个可以稳定而持续的服务器,比如 ...

  8. nginx+awstats安装过程

    awstats来来回回也装了好多遍了,每次都是现装现查,隐约的记得整个配置比较麻烦,中间有几个需要特别注意的地方,又记不得那些需要特殊对待,只能边找资料边回忆,最终还是搞出来了,在此分享给大家. 首先 ...

  9. centos 系统下安装FastDFS+nginx+fastdfs-nginx-module安装配置

    前言: 以前的项目上传的文件都是保存到本地或者是局域网内的共享文件夹下,由于数据量,服务器的负载均衡(分机的某些图片无法访问的问题处理)等因素的情况下,就想到用fastdfs来文件管理,花了几天时间硬 ...

  10. Nginx服务安装配置

    1.Nginx介绍 Nginx是一个高性能的HTTP和反向代理服务器,由俄罗斯人开发的,第一个版本发布于2004年10月4日.Nginx由于出色的性能,在世界范围内受到了越来越多人的关注,其特点是占有 ...

随机推荐

  1. 【BZOJ】【1385】【Baltic2000】Division expression

    欧几里得算法 普通的求个gcd即可……思路题 因为要求尽量是整数……所以 $\frac{x_1}{x_2*x_3*x_4*....*x_n}$是最大的结果了,因为$x_2$必须为分母,$x_1$必须为 ...

  2. ios开发之触摸&手势识别

    概要: 4个触摸事件.6个手势识别.响应者链条 1.4个触摸事件 1> 触摸事件主要是针对视图的,包括 - (void)touchesBegan:(NSSet *)touches withEve ...

  3. PHP读取xml之cdata讲解

    实例: xss.xml <?xml version="1.0" encoding="UTF-8"?><filters>    <f ...

  4. 【转】System.DateTime.Now.ToString()的一些用法

    C#中的日期处理函数     //2007年4月24日     this.TextBox6.Text = System.DateTime.Now.ToString("D");    ...

  5. object-c 入门基础篇

    原地址:http://www.cnblogs.com/moonvan/archive/2011/10/13/2210498.html 一.Objective-C与C的渊源 Objective-C诞生于 ...

  6. NGINX的奇淫技巧 —— 5. NGINX实现金盾防火墙的功能(防CC)

    NGINX的奇淫技巧 —— 5. NGINX实现金盾防火墙的功能(防CC) ARGUS 1月13日 发布 推荐 0 推荐 收藏 2 收藏,1.1k 浏览 文章整理中...... 实现思路 当服务器接收 ...

  7. WCF 笔记 (2) - 传输泛型 List 对象

    WCF 笔记 (2) - 传输泛型 List 对象 本帖介绍怎么在 WCF 中,在 Server-side 和 Client-side 之间,传递默认无法传输的 List<T>.List& ...

  8. PHP-Phalcon框架中的数据库操作

    > 本文描述了PHP-Phalcon框架中数据库操作方法,主要讨论Phalcon框架的Model组件中的操作方法.更详细的Model介绍请参考:官方文档 1. 连接数据库 在Phalcon框架中 ...

  9. 为什么Android 3.0如此罕见?

    3.0(2011年2月)代号蜂巢,专用于android系统的平板电脑,不用于手机.4.0(2011年5月公布)的开发就是让平板电脑和手机能够共用一个版本的系统.4.0通用于平板电脑和手机.

  10. 解决virtualbox 虚拟机不能ping通win7

    凭经验猜测是由于防火墙引起的,关闭防火墙再ping,果然可行.google说这是由于“win7 防火墙默认的禁ping策略”引起的.但是关闭防火墙很不安全,可以按照以下步骤为防火墙添加入站规则来解决问 ...