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由于出色的性能,在世界范围内受到了越来越多人的关注,其特点是占有 ...
随机推荐
- uva 11489
简单博弈 #include <cstdio> #include <cstdlib> #include <cmath> #include <map> #i ...
- LVS+Keepalived实现高可用集群
LVS+Keepalived实现高可用集群来源: ChinaUnix博客 日期: 2009.07.21 14:49 (共有条评论) 我要评论 操作系统平台:CentOS5.2软件:LVS+keepal ...
- SilverLight页面跳转(转载)
// Silverlight页面的跳转 // (Application.Current.RootVisualasIContent).Content=newDragControl(); //Silver ...
- HDU 3397 Sequence operation (区间合并,操作比较多)
费了我一天半的时间,到处debug,后来才发现,主要是建树的时候只在叶子节点对lazy1和lazy2进行初始化了,父节点都没初始化...晕. 具体见代码吧. #include <iostream ...
- Ubuntu环境下Hadoop1.2.1, HBase0.94.25, nutch2.2.1各个配置文件一览
/×××××××××××××××××××××××××××××××××××××××××/ Author:xxx0624 HomePage:http://www.cnblogs.com/xxx0624/ ...
- 01 - 编译链接第一个wxWidgets3.0例子
1. preprocessor #define __WXMSW__#define WXUSINGDLL 2. vc10中设置Include dir, lib dir, dll path VC++平台编 ...
- Oracle的学习三:java连接Oracle、事务、内置函数、日期函数、转换函数、系统函数
1.java程序操作Oracle java连接Oracle JDBC_ODBC桥连接 1.加载驱动: Class.forName("sun.jdbc.odbc.JdbcodbcDriver& ...
- lintcode: 把排序数组转换为高度最小的二叉搜索树
题目: 把排序数组转换为高度最小的二叉搜索树 给一个排序数组(从小到大),将其转换为一棵高度最小的排序二叉树. 样例 给出数组 [1,2,3,4,5,6,7], 返回 4 / \ 2 6 / \ / ...
- 【PSR规范专题(1)】PSR-0+namespace+spl_autoload_register实现框架模型
了解命名空间 namespace是PHP5.3版本加入的新特性,用来解决在编写类库或应用程序时创建可重用的代码如类或函数时碰到的两类问题: 用户编写的代码与PHP内部的类/函数/常量或第三方类/函数/ ...
- JAVA学习路线图---(JAVA1234)
第一阶段-Java基础 这一阶段很重要,关系到你后面阶段的学习,所以务必把这一阶段掌握好: 如果你是0基本,我推荐一本比较好的,适合初学者看的书:明日科技的<Java从入门到精通>,最 ...