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由于出色的性能,在世界范围内受到了越来越多人的关注,其特点是占有 ...
随机推荐
- thinpad E43系列WIN8装WIN7系统
昨晚WIN8系统下装WIN7 折腾了好久,故此总结一下写一篇U盘装WIN7 : 先简述一下思路:BOSS设置启动项------->U盘启动--------> 进入PE删除所有分区----- ...
- new Date()的数据类型的问题
function getServerNow(){ return new Date(new Date() + svrMinusLocal); } svrMinusLocal是服务器时间减本地时间的时间差 ...
- XML注入介绍--XXE,XEE,xpath等
XML注入指在请求的XML中插入攻击利用代码.根据不同的场景,可能会形成以下的漏洞形式: (1)XEE ----xml entity xpansion(xml实体膨胀,用于dos) 具体介绍:http ...
- linux系统清空文件内容
本文转载至:http://www.jbxue.com/LINUXjishu/14410.html 本文介绍下,在linux系统中,清空文件内容的方法,使用cat命令.echo命令,将文件内容截断为0字 ...
- POJ 2253 Frogger (求某两点之间所有路径中最大边的最小值)
题意:有两只青蛙,a在第一个石头,b在第二个石头,a要到b那里去,每种a到b的路径中都有最大边,求所有这些最大边的最小值.思路:将所有边长存起来,排好序后,二分枚举答案. 时间复杂度比较高,344ms ...
- JsRender系列demo(6)-无名
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.j ...
- eclipse 或MyEclipse将工程进行移动的时候会对@Override报错的处理方法
有时候导入javaSE,javaEE,android 工程的时候,明明是刚刚用过的没有问题的工程,但重新导入的时候就报错. 提示The method ... must override a sperc ...
- Robot framework+python安装使用图解版
一.安装包 1.Python2.7(一切的基础,切记安装目录不能有中文不能有空格) 1)python2.7:(python环境):python-2.7.msi 2)setuptools(python包 ...
- linux入门教程(四) 初步进入linux世界
[Linux 系统启动过程] Linux的启动其实和windows的启动过程很类似,不过windows我们是无法看到启动信息的,而linux启动时我们会看到许多启动信息,例如某个服务是否启动. Lin ...
- lintcode:next permutation下一个排列
题目 下一个排列 给定一个整数数组来表示排列,找出其之后的一个排列. 样例 给出排列[1,3,2,3],其下一个排列是[1,3,3,2] 给出排列[4,3,2,1],其下一个排列是[1,2,3,4] ...