CentOS 7-4:192.168.18.148---->服務(wù)器
我們提供的服務(wù)有:網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、耒陽ssl等。為千余家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的耒陽網(wǎng)站制作公司
win 7-1:192.168.18.129---->客戶機
[root@localhost ~]# yum install bind httpd -y
[root@localhost ~]# vim /etc/named.conf
options {
listen-on port 53 { any; }; #127.0.0.1改為any
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { any; }; #localhost改為any
#修改完成后按Esc退出插入模式,輸入:wq保存退出
[root@localhost ~]# vim /etc/named.rfc1912.zones
#添加以下五行
zone "kgc.com" IN {
type master;
file "kgc.com.zone";
allow-update { none; };
};
#修改完成后按Esc退出插入模式,輸入:wq保存退出
[root@localhost ~]# cd /var/named/
[root@localhost named]# cp -p named.localhost kgc.com.zone
[root@localhost named]# vim kgc.com.zone
#刪除最后一行之后再插入以下內(nèi)容
www IN A 192.168.18.148
[root@localhost named]# systemctl start named
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf
Listen 192.168.18.148:80 #41行刪除注釋,IP地址為linux的地址
#Listen 80 #42行添加注釋
ServerName www.kgc.com:80 #95行作此更改
#修改完成后按Esc退出插入模式,輸入:wq保存退出
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# cd /var/log/httpd/
[root@localhost httpd]# cat access_log
192.168.18.129 - - [16/Dec/2019:13:31:15 +0800] "GET / HTTP/1.1" 403 4897 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"
.......下面省略多行
#此時可以看到129的地址來訪問的記錄
[root@localhost httpd]# mkdir /aaa
[root@localhost httpd]# mount.cifs //192.168.10.190/rpm /aaa
Password for root@//192.168.10.190/rpm:
[root@localhost httpd]# cd /aaa
[root@localhost aaa]# ls
apr-1.6.2.tar.gz hzw.jpeg php
apr-util-1.6.0.tar.gz inotify-tools-3.14.tar.gz redis-5.0.7.tar.gz
awstats-7.6.tar.gz jdk ruby-2.4.1.tar.gz
[root@localhost aaa]# tar zxvf awstats-7.6.tar.gz -C /opt/
[root@localhost aaa]# cd /opt/
[root@localhost opt]# mv awstats-7.6/ /usr/local/awstats
[root@localhost opt]# cd /usr/local/
[root@localhost local]# ls
awstats bin etc games include lib lib64 libexec sbin share src
[root@localhost local]# cd awstats/tools/
[root@localhost tools]# ls
awstats_buildstaticpages.pl dolibarr maillogconvert.pl xslt
awstats_configure.pl geoip_generator.pl nginx
awstats_exportlib.pl httpd_conf urlaliasbuilder.pl
awstats_updateall.pl logresolvemerge.pl webmin
[root@localhost tools]# ./awstats_configure.pl
......此處省略多行
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 #輸入Apache的配置文件路徑
......此處省略多行
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y #確定新建
......此處省略多行
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):
> #直接回車
-----> Restart Web server with '/sbin/service httpd restart'
Redirecting to /bin/systemctl restart httpd.service #此時會重啟apache服務(wù)
......此處省略多行
Press ENTER to continue... #直接回車
......此處省略多行
> 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 #提示訪問路徑,在地址欄中輸入就可以看到日志訪問系統(tǒng)的網(wǎng)頁
Press ENTER to finish... #直接回車
#檢查Apache配置文件中是否有awstats的模塊:
[root@localhost tools]# cd /etc/httpd/conf
[root@localhost conf]# vim httpd.conf
#按大寫字母G到末行,可以看到新加入的awstats內(nèi)容,如下:
#注意需要做權(quán)限的修改?。?!
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.
#
<Directory "/usr/local/awstats/wwwroot">
Options None
AllowOverride None
# Order allow,deny 此行需要注釋掉
# Allow from all 此行需要注釋掉
Require all granted #添加此行,同意所有人進(jìn)行訪問
</Directory>
#修改后按Esc退出插入模式,輸入:wq保存退出
[root@localhost conf]# cd /etc/awstats/
[root@localhost awstats]# ls
awstats.www.kgc.com.conf
[root@localhost awstats]# vim awstats.www.kgc.com.conf
LogFile="/var/log/httpd/access_log" #50行,改為需要監(jiān)控的access_log日志文件的位置
DirData="/var/lib/awstats" #220行,分析日志的數(shù)據(jù)存放位置,默認(rèn)不存在,需要創(chuàng)建
#修改后按Esc退出插入模式,輸入:wq保存退出
[root@localhost awstats]# lcd /var/lib/
[root@localhost lib]# ls
AccountsService alsa alternative authconfig bluetooth
certmonger chrony color colord dav
......以下省略多項
#此時沒有awstats文件,需要手動創(chuàng)建
[root@localhost lib]# mkdir awstats
[root@localhost awstats]# systemctl restart httpd #重啟服務(wù)
[root@localhost awstats]# cd /usr/local/awstats/
[root@localhost awstats]# cd tools/
[root@localhost tools]# ./awstats_updateall.pl now #更新數(shù)據(jù)
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: 43
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 0 old records,
Found 43 new qualified records.
[root@localhost tools]# crontab -e
*/5 * * * * /usr/local/awstats/tools/awstats_updateall.pl now #每5分鐘更新一次
#插入內(nèi)容后按Esc退出插入模式,輸入:wq保存退出
crontab: installing new crontab
#此時會提示有新的計劃性任務(wù)
[root@localhost tools]# systemctl start crond
您在 /var/spool/mail/root 中有郵件
[root@localhost tools]# cd /var/www/html
[root@localhost html]# vim aws.html
<html>
<head>
<meta http-equiv=refresh content="0;url=http://www.kgc.com/awstats/awstats.pl?config=www.kgc.com">
</head>
<body></body>
</html>
#插入內(nèi)容后按Esc退出插入模式,輸入:wq保存退出
當(dāng)前名稱:Awstats日志分析(實戰(zhàn))
網(wǎng)頁鏈接:http://jinyejixie.com/article48/igoehp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作、微信公眾號、網(wǎng)站營銷、動態(tài)網(wǎng)站、云服務(wù)器、商城網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)