[root@localhost ~]# yum install httpd -y
[root@localhost ~]# cd /var/log/httpd/
[root@localhost httpd]# ls
[root@localhost httpd]# systemctl start httpd
[root@localhost httpd]# ls
access_log error_log
[root@localhost httpd]#
说明Apache服务是在启动后产生日志文件
[root@localhost httpd]# ls /usr/sbin/rotatelogs
/usr/sbin/rotatelogs
[root@localhost httpd]#
[root@localhost httpd]# vim /etc/httpd/conf/httpd.conf
182行 ErrorLog "| /usr/sbin/rotatelogs -l logs/www.yun.com.error_%Y%m%dlog 86400"
217行 CustomLog "| /usr/sbin/rotatelos -l logs/www.yun.com.access_%Y%m%dlog 86400" combin ed
[root@localhost httpd]# systemctl restart httpd
[root@localhost httpd]# cd /var/log/httpd/
[root@localhost httpd]# ls
access_log error_log www.yun.com.error_20191216log
[root@localhost httpd]#
[root@localhost httpd]# date -s 12/17/19
2019年 12月 17日 星期二 00:00:00 CST
[root@localhost httpd]# date
2019年 12月 17日 星期二 00:00:02 CST
[root@localhost httpd]# ls
access_log error_log www.yun.com.error_20191216log
[root@localhost httpd]# ls
access_log www.yun.com.access_20191217log www.yun.com.error_20191217log
error_log www.yun.com.error_20191216log
[root@localhost httpd]#
date命令是查看当前系统时间,-s 17/12/19 代表2019年12月17日
[root@localhost ~]# yum install bind httpd -y
[root@localhost ~]# vim /etc/named.conf
13行 listen-on port 53 { any; }; 将127.0.0.1修改为any
21行 allow-query { any; }; 将localhost修改为any
[root@localhost ~]# vim /etc/named.rfc1912.zones
5yy复制模板
25行 zone "yun.com" IN { //localhost修改为要解析的域名yun.com
26行 type master; //不做更改
27行 file "yun.com.zone"; //yun.com.zone要与区域数据配置文件名称相同
28行 allow-update { none; };//不做更改
29行 };
[root@localhost ~]# cd /var/named/
[root@localhost named]# ls
data named.ca named.localhost slaves
dynamic named.empty named.loopback
[root@localhost named]# cp -p named.localhost yun.com.zone
//注意:复制模板时-p参数不可缺少
[root@localhost named]# vim yun.com.zone
1行 $TTL 1D
2行 @ IN SOA @ rname.invalid. (
3行 0 ; serial
4行 1D ; refresh
5行 1H ; retry
6行 1W ; expire
7行 3H ) ; minimum
8行 NS @
9行 A 127.0.0.1
10行 AAAA
11行 www IN A 192.168.179.136
//第10行删除
//新添加域名为www IN A 192.168.179.136 DNS服务的IP地址
[root@localhost named]# systemctl start named
[root@localhost opt]# ls
apr-1.6.2.tar.gz awstats-7.6.tar.gz john-1.8.0.tar.gz
apr-util-1.6.0.tar.gz Discuz_X2.5_SC_UTF8.zip mysql-5.6.26.tar.gz
awstats-7.6.rar httpd-2.4.29.tar.bz2 php-5.6.11.tar.bz2
[root@localhost opt]# tar zvxf awstats-7.6.tar.gz -C /usr/local/
[root@localhost local]# cd /usr/local/
[root@localhost local]# ls
awstats-7.6 bin etc games include lib lib64 libexec sbin share src
[root@localhost local]# mv awstats-7.6/ awstats
[root@localhost local]# ls
awstats bin etc games include lib lib64 libexec sbin share src
[root@localhost local]#
[root@localhost tools]# ./awstats_configure.pl
Config file path ('none' to skip web server setup):
> /etc/httpd/conf/httpd.conf 回车 //指向Apache服务的主配置文件
file (required if first install) [y/N] ? y 回车
Your web site, virtual server or profile name:
> www.yun.com //输入解析的域名 回车
//然后一直回车至配置完成
[root@localhost tools]# vim /etc/awstats/awstats.www.yun.com.conf
50行 LogFile="/var/log/httpd/access_log" //修改为Apache服务的访问日志文件
220 DirData="/var/lib/awstats" //在/var/lib目录中没有awstats目录,需要创建此目录
[root@localhost tools]# mkdir /var/lib/awstats
95行 ServerName www.yun.com:80 //开启域名服务
41 Listen 192.168.179.156:80 //开启IPV4监听功能,IP更改为主机IP地址
42 #Listen 80 //关闭IPV6监听功能
366
367 Options None
368 AllowOverride None
369 # Order allow,deny //注释
370 # Allow from all //注释
371 Require all granted //访问权限更改为全部都可以访问Apache服务网站
372
[root@localhost tools]# systemctl restart httpd
[root@localhost tools]# systemctl start named
[root@localhost tools]# systemctl stop firewalld.service
[root@localhost tools]# setenforce 0
[root@localhost tools]#
[root@localhost tools]# ./awstats_updateall.pl now
Running '"/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -update -config=www.yun.com -configdir="/etc/awstats"' to update config www.yun.com
Create/Update database for config "/etc/awstats/awstats.www.yun.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...
Jumped lines in file: 0
Parsed lines in file: 0
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 0 old records,
Found 0 new qualified records.
[root@localhost tools]#