真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

Apache的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)

@[toc]
前言:
apache配置剖析

創(chuàng)新互聯(lián)公司服務(wù)項(xiàng)目包括隴川網(wǎng)站建設(shè)、隴川網(wǎng)站制作、隴川網(wǎng)頁制作以及隴川網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,隴川網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到隴川省份的部分城市,未來相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!

  • apache鏈接保持
  • apache訪問控制
  • 使用黑白名單,身份驗(yàn)證進(jìn)行訪問控制
    apache日志管理
  • 日志分割
  • AWStats日志分析

日志文件如何產(chǎn)生
管理日志的工具學(xué)習(xí)

一:apache連接保持

1.1 apache 連接保持相關(guān)參數(shù)

1.1.1 KeepAlive

  • 是否打開連接保持,OFF關(guān)閉,ON打開

    1.1.2 KeepAliveTimeout

  • 一次連接多次請(qǐng)求之間的最大間隔時(shí)間,兩次請(qǐng)求超過該時(shí)間連接斷開————可以對(duì)資源進(jìn)行優(yōu)化

    1.1.3 MaxKeepAliveRequests

  • 一次連接能夠傳輸?shù)淖畲笳?qǐng)求數(shù)量————并發(fā)量

二:apache訪問控制概述

2.1 apache訪問控制

2.1.1 作用

  • 控制對(duì)網(wǎng)站資源的訪問
  • 為特定的網(wǎng)站目錄添加訪問授權(quán)

    2.1.2 常用訪問控制方式

  • 客戶機(jī)地址限制
  • 用戶授權(quán)限制
    Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)

    2.2 基于客戶端地址的訪問控制

  • 使用Require配置項(xiàng)實(shí)現(xiàn)訪問控制,按先后順序限制
  • 可用于、、配置段中
  • Require配置項(xiàng)的常見語法
    Require all granted——————允許所有權(quán)限
    Require all denied——————拒絕所有權(quán)限
    Require local——————————允許本地權(quán)限
    Require [not] host <主機(jī)名或域名列表>————允許或拒絕主機(jī)名
    Reuire [not] ip ——————允許或拒絕IP網(wǎng)段

備注:使用not禁止訪問時(shí)要將其置于容器中并在容器中指定相應(yīng)的限制策略

[root@localhost html]# vim /etc/httpd/conf/extra/vhost.conf 

  DocumentRoot "/var/www/html/kgc"
  ServerName www.kgc.com
  Errorlog "logs/www.kgc.com.error_log"
  Customlog "logs/www.kgc.comaccess_log" common
  
  
  Require not ip 192.168.247.157
   Require all granted
  
  

Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)

[root@localhost html]# systemctl restart httpd

Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)

三:用戶授權(quán)限制

3.1 創(chuàng)建用戶認(rèn)證數(shù)據(jù)庫

選項(xiàng) -c ,代表新建用戶認(rèn)證數(shù)據(jù)庫,若是想向現(xiàn)有數(shù)據(jù)庫寫入用戶數(shù)據(jù),不需要加-c,即可寫入

[root@localhost named]# htpasswd -c /etc/httpd/conf/httppasswd zhangsan
New password: 
Re-type new password: 
Adding password for user zhangsan
[root@localhost named]# cat /etc/httpd/conf/httppasswd 
zhangsan:$apr1$IivUd6IL$J8zc5KAHgsQsoqSkPI1EP.
[root@localhost named]# htpasswd  /etc/httpd/conf/httppasswd lisi
New password: 
Re-type new password: 
Adding password for user lisi
[root@localhost named]# cat /etc/httpd/conf/httppasswd 
zhangsan:$apr1$IivUd6IL$J8zc5KAHgsQsoqSkPI1EP.
lisi:$apr1$FRyBVvZl$FBdIus.U9PpGVvmEgyAIK0
[root@localhost named]# htpasswd -c /etc/httpd/conf/httppasswd wangermazi
New password: 
Re-type new password: 
Adding password for user wangermazi
[root@localhost named]# cat /etc/httpd/conf/httppasswd 
wangermazi:$apr1$WwVYzzto$/ydcv1CaajW6e4Qi87D7u.

3.2 添加用戶授權(quán)配置,開啟用戶認(rèn)證數(shù)據(jù)庫從服務(wù)器自身的層面去控制服務(wù)

以上次配置的虛擬web主機(jī)之一為例


  DocumentRoot "/var/www/html/accp"
  ServerName www.accp.com
  Errorlog "logs/www.accp.com.error_log"
  Customlog "logs/www.accp.comaccess_log" common
  
   authname "documentroot"
   authtype basic
   authuserfile /etc/httpd/conf/httppasswd
   require valid-user
 

AuthName "DocumentRoot" ————制定受保護(hù)的領(lǐng)域名稱,就是web站點(diǎn)目錄
AuthType Basic ————認(rèn)證類型
AuthUserFile /etc/httpd/conf/httppasswd ————用戶認(rèn)證帳號(hào)文件,也就是剛才創(chuàng)建的用戶認(rèn)證數(shù)據(jù)庫
Require valid-user ————要求通過認(rèn)證才能訪問

然后重啟httpd服務(wù)

[root@localhost extra]# systemctl restart httpd

3.3 客戶機(jī)實(shí)驗(yàn)

Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)
Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)
Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)

四:日志分割

4.1 隨著網(wǎng)站的訪問量增加,默認(rèn)情況下Apache的單個(gè)日志文件也會(huì)越來越大

  • 日志文件在日積月累下,占用磁盤空間會(huì)很大
  • 查看相關(guān)信息會(huì)不方便

    4.2 對(duì)日志文件進(jìn)行分割的兩種工具

  • Apache自帶rotatelogs分割工具實(shí)現(xiàn)
  • 第三方工具cronolog分割

    4.3 rotatelogs分割工具

  • 配置網(wǎng)站的日志文件轉(zhuǎn)交給rotatelogs分割處理
  • 配置格式————
ErrorLog "| /usr/sbin/rotatelogs -l logs/error_%Y%m%d.log 86400"
CustomLog "| /usr/sbin/rotatelogs -l logs/access_%Y%m%d.log 86400" combined

備注:在實(shí)際生產(chǎn)環(huán)境中,一個(gè)服務(wù)器絕大多數(shù)對(duì)應(yīng)N個(gè)子域名站點(diǎn),為了方便同意管理,可以用虛擬主機(jī)的方式進(jìn)行配置,并用網(wǎng)站名標(biāo)識(shí)日志文件
例如:ErrorLog “| rotatelogs(命令的絕對(duì)路徑) -l 日志文件路徑/網(wǎng)站名-error_%Y%m%d.log 86400”

4.4 實(shí)驗(yàn):

恢復(fù)快照,開始配置

4.4.1 關(guān)閉防火墻,增強(qiáng)服務(wù)

[root@localhost ~]# systemctl stop firewalld.service 
[root@localhost ~]# setenforce 0
[root@localhost ~]# 

4.4.2 安裝Apache

[root@localhost ~]# yum install httpd -y

4.4.3 此時(shí)日志目錄中沒有日志文件

[root@localhost ~]# cd /etc/httpd/logs
[root@localhost logs]# ls
[root@localhost logs]# cd ..
[root@localhost httpd]# ls -l
total 0
drwxr-xr-x. 2 root root  37 Dec 12 20:07 conf
drwxr-xr-x. 2 root root  82 Dec 12 20:07 conf.d
drwxr-xr-x. 2 root root 146 Dec 12 20:07 conf.modules.d
lrwxrwxrwx. 1 root root  19 Dec 12 20:07 logs -> ../../var/log/httpd
lrwxrwxrwx. 1 root root  29 Dec 12 20:07 modules -> ../../usr/lib64/httpd/modules
lrwxrwxrwx. 1 root root  10 Dec 12 20:07 run -> /run/httpd

4.4.4 開啟服務(wù),查看日志目錄下,發(fā)現(xiàn)出現(xiàn)了錯(cuò)誤日志和登陸日志,如果不對(duì)其進(jìn)行配置,則每日都會(huì)把

[root@localhost httpd]# systemctl start httpd
[root@localhost httpd]# ls logs
access_log  error_log

4.4.5 配置兩個(gè)文件屬性

[root@localhost httpd]# which rotatelogs
/usr/sbin/rotatelogs
[root@localhost httpd]# vim /etc/httpd/conf/httpd.conf 
ErrorLog "| /usr/sbin/rotatelogs -l logs/error_%Y%m%d.log 86400"
CustomLog "| /usr/sbin/rotatelogs -l logs/access_%Y%m%d.log 86400" combined

4.4.6 重啟服務(wù),查看日志目錄

[root@localhost httpd]# systemctl restart httpd
[root@localhost httpd]# ls logs
access_log  error_20191212.log  error_log
[root@localhost httpd]# 

4.4.7 訪問一次

訪問一次
Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)
access日志文件也出現(xiàn)了

[root@localhost httpd]# ls logs
access_20191212.log  access_log  error_20191212.log  error_log

4.5 cronolog工具

4.5.1 快照恢復(fù)新環(huán)境

重新安裝thppd

4.5.2 掛載共享目錄導(dǎo)入cronolog 軟件包到系統(tǒng)內(nèi)

[root@localhost ~]# mount.cifs //192.168.254.10/linuxs /abc
Password for root@//192.168.254.10/linuxs:  
[root@localhost ~]# cd /abc
[root@localhost abc]# ls
cronolog-1.6.2-14.el7.x86_64.rpm  LAMP-php5.6.txt             修改網(wǎng)卡為靜態(tài)IP地址.txt
dhcp.txt                          MAC 記錄與端口掃描腳本.txt  開發(fā)系統(tǒng)監(jiān)控腳本.txt
extundelete-0.2.4.tar.bz2         pxe.txt                     引導(dǎo)系統(tǒng)腳本.txt
httpd2.4.2版本                    pxe速成秘籍.txt             測試網(wǎng)段是否存活,測試存活網(wǎng)段的21端口.txt
john-1.8.0.tar.gz                 qqq.html                    監(jiān)控系統(tǒng)內(nèi)存cpu磁盤容量1.0.txt
LAMP-C7                           vsftpd添加虛擬用戶腳本.TXT
LAMP-C7.rar                       不同域名創(chuàng)建虛擬主機(jī).TXT
[root@localhost abc]# cp -p cronolog-1.6.2-14.el7.x86_64.rpm /opt
-bash: ls/opt: No such file or directory
[root@localhost abc]# cd /opt
[root@localhost opt]# ls
cronolog-1.6.2-14.el7.x86_64.rpm  rh
[root@localhost opt]# rpm -ivh cronolog-1.6.2-14.el7.x86_64.rpm 
warning: cronolog-1.6.2-14.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:cronolog-1.6.2-14.el7            ################################# [100%]   
[root@localhost opt]# cron
crond       cronolog    cronosplit  crontab     
[root@localhost opt]# which cronolog
/usr/sbin/cronolog

4.5.3 關(guān)閉防火墻和增強(qiáng)服務(wù)

[root@localhost opt]# systemctl stop firewalld.service 
[root@localhost opt]# setenforce 0

4.5.4 修改配置文件中的日志參數(shù)

[root@localhost opt]# vim /etc//httpd/conf/httpd.conf 
ErrorLog "| /usr/sbin/cronolog logs/error_%Y%m%d.log"
CustomLog "| /usr/sbin/cronolog logs/access_%Y%m%d.log" combined

4.5.5 開啟服務(wù)

[root@localhost opt]# systemctl start httpd

4.5.6 查看日志目錄

[root@localhost logs]# ls
error_20191213.log

4.5.6 訪問apache會(huì)產(chǎn)生access記錄

Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)

[root@localhost logs]# ls
access_20191213.log  error_20191213.log

4.5.7 時(shí)間加速驗(yàn)證——使用date -s 驗(yàn)證

[root@localhost logs]# date -s 2019-12-31
Tue Dec 31 00:00:00 CST 2019
[root@localhost logs]# ls
access_20191213.log  error_20191213.log
[root@localhost logs]# systemctl restart httpd
[root@localhost logs]# ls -l
total 12
-rw-r--r--. 1 root root 1546 Dec 13 09:11 access_20191213.log
-rw-r--r--. 1 root root  888 Dec 13 09:11 error_20191213.log
-rw-r--r--. 1 root root  750 Dec 31 00:00 error_20191231.log

五:部署AWStats日志分析系統(tǒng)

AWStats 日志分析系統(tǒng)介紹

  • Perl語言開發(fā)的一款開源日志分析系統(tǒng)
  • 可用來分析Apache、Samba、Vsftpd、IIS等服務(wù)器的訪問日志
  • 信息結(jié)合crond等計(jì)劃任務(wù)服務(wù),可對(duì)日志內(nèi)容定期進(jìn)行分析
    Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)

    5.1 安裝AWStats軟件包

    [root@localhost ~]# mount.cifs //192.168.254.10/linuxs /opt
    Password for root@//192.168.254.10/linuxs:  
    [root@localhost ~]# cd /opt
    [root@localhost opt]# ls
    12.17                             LAMP-php5.6.txt
    8.tar.gz                          MAC 記錄與端口掃描腳本.txt
    awstats-7.6.tar.gz                pxe.txt
[root@localhost opt]# tar -xzf awstats-7.6.tar.gz -C /mnt
[root@localhost opt]# cd /mnt
[root@localhost mnt]# ls
12.17  awstats-7.6
[root@localhost mnt]# umount /opt
[root@localhost mnt]# ls /opt
rh
[root@localhost mnt]# mv awstats-7.6 /usr/local/awstats

awstats內(nèi)的文件

[root@localhost mnt]# cd /usr/local/awstats/
[root@localhost awstats]# ls
docs  README.md  tools  wwwroot
[root@localhost awstats]# cd tools/
[root@localhost tools]# ls
awstats_buildstaticpages.pl  awstats_updateall.pl  httpd_conf          nginx               xslt
awstats_configure.pl         dolibarr              logresolvemerge.pl  urlaliasbuilder.pl
awstats_exportlib.pl         geoip_generator.pl    maillogconvert.pl   webmin

備注:此時(shí)可以也配置bind和httpd進(jìn)行實(shí)操演練

[root@localhost ~]# yum install bind httpd -y
Installed:
  bind.x86_64 32:9.11.4-9.P2.el7                httpd.x86_64 0:2.4.6-90.el7.centos   
 [root@localhost tools]# vim /etc/named.conf 
 12 options {
 13         listen-on port 53 { any; };
 14         listen-on-v6 port 53 { ::1; };
 15         directory       "/var/named";
 16         dump-file       "/var/named/data/cache_dump.db";
 17         statistics-file "/var/named/data/named_stats.txt";
 18         memstatistics-file "/var/named/data/named_mem_stats.txt";
 19         recursing-file  "/var/named/data/named.recursing";
 20         secroots-file   "/var/named/data/named.secroots";
 21         allow-query     { any; };
[root@localhost tools]# vim /etc/named.rfc1912.zones 
zone "kgc.com" IN {
        type master;
        file "kgc.com.zone";
        allow-update { none; };
};
[root@localhost tools]# cp -p /var/named/named.localhost kgc.com.zone
[root@localhost tools]# vim kgc.com.zone 
        A       192.168.247.149
www     IN      A       192.168.247.149
[root@localhost named]# systemctl start named
[root@localhost named]# netstat -natp | grep named
tcp        0      0 192.168.247.149:53      0.0.0.0:*               LISTEN      37654/named         
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      37654/named         
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      37654/named         
tcp6       0      0 ::1:53                  :::*                    LISTEN      37654/named         
tcp6       0      0 ::1:953                 :::*                    LISTEN      37654/named     
[root@localhost named]# systemctl stop firewalld.service 
[root@localhost named]# setenforce 0

配置httpd

[root@localhost named]# vim /etc/httpd/conf/httpd.conf 
41 Listen 192.168.247.149:80
42 #Listen 80
95 ServerName www.kgc.com:80

5.2 為要統(tǒng)計(jì)的站點(diǎn)建立配置文件

[root@localhost named]# cd /usr/local/awstats/
[root@localhost awstats]# ls
docs  README.md  tools  wwwroot
[root@localhost awstats]# cd tools/
[root@localhost tools]# ls
awstats_buildstaticpages.pl  dolibarr            logresolvemerge.pl  webmin
awstats_configure.pl         geoip_generator.pl  maillogconvert.pl   xslt
awstats_exportlib.pl         httpd_conf          nginx
awstats_updateall.pl         kgc.com.zone        urlaliasbuilder.pl

pl為結(jié)尾的是腳本文件,若是不可執(zhí)行,需要額外給其增加執(zhí)行權(quán)限

[root@localhost tools]# ./awstats_configure.pl 

----- AWStats awstats_configure 1.0 (build 20140126) (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):
-----------------------------------------輸入配置文件路徑-------------------------------------------------
> /etc/httpd/conf/httpd.conf

-----> Check and complete web server config file '/etc/httpd/conf/httpd.conf'
  Add 'Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"'
  Add 'Alias /awstatscss "/usr/local/awstats/wwwroot/css/"'
  Add 'Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"'
  Add 'ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"'
  Add '' directive
  AWStats directives added to Apache config file.

-----> 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.kgc.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):
--------------------------------------------默認(rèn)即可,回車-------------------------------------------------
> 

-----> Create config file '/etc/awstats/awstats.www.kgc.com.conf'
 Config file /etc/awstats/awstats.www.kgc.com.conf created.

-----> Restart Web server with '/sbin/service httpd restart'
Redirecting to /bin/systemctl restart httpd.service

-----> 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.kgc.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... 
--------------------------------------------回車----------------------------------------------------

A SIMPLE config file has been created: /etc/awstats/awstats.www.kgc.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'www.kgc.com' with command:
> perl awstats.pl -update -config=www.kgc.com
You can also read your statistics for 'www.kgc.com' with URL:
> http://localhost/awstats/awstats.pl?config=www.kgc.com
//http://localhost/awstats/awstats.pl?config=www.kgc.com這個(gè)路徑是登陸awstats的站點(diǎn)
Press ENTER to finish...
-------------------------------------------回車完成--------------------------------------------------------------------

[root@localhost tools]# 

5.3 為要統(tǒng)計(jì)的站點(diǎn)建立配置文件

下面是awstats寫入的數(shù)據(jù)

#
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"

#
# This is to permit URL access to scripts/files in AWStats directory.
#

    Options None
    AllowOverride None
    Order allow,deny
    Allow from all

對(duì)其進(jìn)行修改

[root@localhost tools]# vim /etc/httpd/conf/httpd.conf 

    Options None
    AllowOverride None
#    Order allow,deny
#    Allow from all
    Require all granted

Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)

5.4 修改站點(diǎn)統(tǒng)計(jì)配置文件

[root@localhost tools]# vim /etc/awstats/awstats.www.kgc.com.conf 
 50 LogFile="/var/log/httpd/access_log"
220 DirData="/var/lib/awstats"

dirdata 數(shù)據(jù)存儲(chǔ)目錄,因?yàn)檫@個(gè)目錄不存在,所以創(chuàng)建這個(gè)目錄

[root@localhost tools]# mkdir /var/lib/awstats

5.4.2 重新啟動(dòng)httpd

[root@localhost tools]# systemctl restart httpd
[root@localhost tools]# 

Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)
備注:http://localhost/awstats/awstats.pl?config=www.kgc.com中的localhost修改為域名
Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)

5.5 刷新日志數(shù)據(jù)./awstats_updateall.pl now

[root@localhost tools]# ./awstats_updateall.pl now
Running '"/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -update -config=www.kgc.com -configdir="/etc/awstats"' to update config www.kgc.com
Create/Update database for config "/etc/awstats/awstats.www.kgc.com.conf" by AWStats version 7.6 (build 20161204)
From data in log file "/var/log/httpd/access_log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 250
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 1 corrupted records,
 Found 0 old records,
 Found 249 new qualified records.

Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)

5.6 執(zhí)行日志分析,并設(shè)置cron計(jì)劃任務(wù)

5.6.1 首先先獲取該執(zhí)行腳本的絕對(duì)路徑

[root@localhost tools]# pwd
/usr/local/awstats/tools
[root@localhost tools]# ls
awstats_buildstaticpages.pl  awstats_updateall.pl  httpd_conf          nginx               xslt
awstats_configure.pl         dolibarr              logresolvemerge.pl  urlaliasbuilder.pl
awstats_exportlib.pl         geoip_generator.pl    maillogconvert.pl   webmin
[root@localhost tools]# 

5.6.2 然后進(jìn)行添加crond任務(wù),開啟crond,設(shè)置開機(jī)自啟動(dòng)

[root@localhost tools]# crontab -e
*/5 * * * * /usr/local/awstats/tools/awstats_updateall.pl now
[root@localhost tools]# crontab -l
*/5 * * * * /usr/local/awstats/tools/awstats_updateall.pl now
[root@localhost tools]# systemctl start crond
[root@localhost tools]# systemctl enable crond

六 :訪問AWStats分析系統(tǒng)

6.1 查看統(tǒng)計(jì)頁面

Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)

6.2 設(shè)置頁面自動(dòng)跳轉(zhuǎn),方便訪問

[root@localhost tools]# cd /var
[root@localhost var]# ls
account  cache  db     games   kerberos  local  log   named  opt       run    target  www
adm      crash  empty  gopher  lib       lock   mail  nis    preserve  spool  tmp     yp
[root@localhost var]# cd www/
[root@localhost www]# ls
cgi-bin  html
[root@localhost www]# cd html/
[root@localhost html]# ls
[root@localhost html]# vim aws.html

 
   
 
 

6.2.2 然后重新啟動(dòng)httpd

[root@localhost html]# systemctl restart httpd

Apache 的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)

總結(jié)

  • Apache鏈接保持相關(guān)參數(shù)
  • Apache訪問控制作用及常用控制方式
  • Apache日志分割方法
  • AWStats分析系統(tǒng)部署及應(yīng)用

分享文章:Apache的配置與應(yīng)用、日志管理(rotatelogs、cronolog、AWStats)
文章來源:http://weahome.cn/article/giicop.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部