Nginx & AWStats 安装、配置、使用
—— 参考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.comPress 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 安装、配置、使用的更多相关文章
- nginx初级安装配置
nginx初级安装配置 转自:(lykyl原创)http://www.cnblogs.com/lykyl/archive/2012/11/21/2781077.html 实验环境:系统 CENTOS5 ...
- nginx+tomcat安装配置
nginx+tomcat安装配置 # nginx+tomcat安装配置 #创建网站目录 mkdir -p /www/wwwroot cd /www #安装配置 wget http://mirrors. ...
- gerrit+nginx+centos安装配置
安装环境 centos 6.8 gerrit-full-2.5.2.war 下载地址:https://gerrit-releases.storage.googleapis.com/gerrit-ful ...
- Nginx的安装配置和tomcat负载均衡
Nginx简介 什么是nginx? Nginx是一款高性能的http 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器.由俄罗斯的程序设计师Igor Sysoev所开发,官方测试ngi ...
- Nginx+nagios安装配置
Nginx+nagios安装配置 [root@Nagios ~]# vi /etc/nginx/nginx.conf server { listen ; server_name localhost; ...
- nginx php-fpm安装配置 CentOS编译安装php7.2
CentOS编译安装php7.2 介绍: 久闻php7的速度以及性能那可是比php5系列的任何一版本都要快,具体性能有多好,建议还是先尝试下再说.如果你是升级或新安装,那你首先需要考虑php7和程序是 ...
- 吴裕雄--天生自然Django框架开发笔记:Django Nginx+uwsgi 安装配置
Django Nginx+uwsgi 安装配置 使用 python manage.py runserver 来运行服务器.这只适用测试环境中使用. 正式发布的服务,需要一个可以稳定而持续的服务器,比如 ...
- nginx+awstats安装过程
awstats来来回回也装了好多遍了,每次都是现装现查,隐约的记得整个配置比较麻烦,中间有几个需要特别注意的地方,又记不得那些需要特殊对待,只能边找资料边回忆,最终还是搞出来了,在此分享给大家. 首先 ...
- centos 系统下安装FastDFS+nginx+fastdfs-nginx-module安装配置
前言: 以前的项目上传的文件都是保存到本地或者是局域网内的共享文件夹下,由于数据量,服务器的负载均衡(分机的某些图片无法访问的问题处理)等因素的情况下,就想到用fastdfs来文件管理,花了几天时间硬 ...
- Nginx服务安装配置
1.Nginx介绍 Nginx是一个高性能的HTTP和反向代理服务器,由俄罗斯人开发的,第一个版本发布于2004年10月4日.Nginx由于出色的性能,在世界范围内受到了越来越多人的关注,其特点是占有 ...
随机推荐
- 【BZOJ】【1834】【ZJOI2010】Network 网络扩容
网络流/费用流 这题……我一开始sb了. 第一问简单的最大流…… 第二问是要建费用流的图的……但是是在第一问的最大流跑完以后的残量网络上建,而不是重建…… 我们令残量网络上原有的弧的费用全部为0(因为 ...
- 01-08-01【Nhibernate (版本3.3.1.4000) 出入江湖】NHibernate中的三种状态
以下属于不明来源资料: 引入 在程序运行过程中使用对象的方式对数据库进行操作,这必然会产生一系列的持久化类的实例对象.这些对象可能是刚刚创建并准备存储的,也可能是从数据库中查询的,为了区分这些对象,根 ...
- 关于Backtracing中有重复元素的处理办法
backtracing是一个常用的解法.之前遇到一个题目,求一个集合的子集, 例如给定{1,2,3,4,5},求其大小为3的子集. 利用backtracing可以较快的给出答案. 然而,该题还有一个变 ...
- fedora下缺少autopoint包的解决办法
编译过程中,报错,缺少autopoint包 然而无论是yum install autopoint 还是yum search autopoint都没有理想的答案 执行yum install gettex ...
- hdoj 1879 继续畅通工程
继续畅通工程 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Sub ...
- java基础知识回顾之---java String final类之intern方法
public class StringObjectDemo { /** * @param args */ public static void main(String[] args) { String ...
- VS2010彻底卸载
下载Microsoft Visual Studio 2010 Uninstall Utility来移除,默认情况下,这将删除 Visual Studio 和支持组件,但不会删除与计算机上的其他应用程序 ...
- iOS UICollectionView简单使用
UICollectionView 和 UICollectionViewController 类是iOS6 新引进的API,用于展示集合视图,布局更加灵活,可实现多列布局,用法类似于UITableVie ...
- JavaWeb项目开发案例精粹-第2章投票系统-004action层
1. package com.sanqing.action; import java.util.UUID; import com.opensymphony.xwork2.ActionSupport; ...
- WCF入门(八)---WCF服务绑定
WCF服务绑定是一个集合,每个元素定义了服务与客户端进行通信方式的几个元素.传输元素和一个消息编码元素各自结合两个最重要的组成部分.这里是WCF服务绑定常用的列表. 基础绑定 基础约束是由basicH ...