赞
踩
● KeepAlive
◆ 是否打开连接保持,Off关闭,On打开
● KeepAlive Timeout //默认是5秒,超过5秒断开
◆ 一次连接多次请求之间的最大间隔时间,两次请求超过该时间连接断开
● MaxKeepAliveRequests //默认数量是100
◆ 一次长连接能够传输的最大请求数量
● vi /usr/ local /httpd/conf/extra/httpd-default. conf
●作用
◆控制对网站资源的访问
◆为特定的网站目录添加访问授权
●常用访问控制方式
◆客户机地址限制
◆用户授权限制
Require all granted: 允许所有主机访问
Require all denied: 拒绝所有主机访问
Require local: 仅允许本地主机访问
Require [not] host <主机名或域名列表>:允许或拒绝指定主机或域名访问
Require [not] ip <IP地址或网段列表>:允许或拒绝指定IP地址网络访问
■ 随着网站的访问量增加,默认情况下Apache的单个日志文件也会越来越大
● 日志文件占用磁盘空间很大
● 查看相关信息不方便
■ 对日志文件进行分割
● Apache自带rotatelogs分割工具实现
● 第三方工具cronolog分割
4、配置AWstats日志分析软件
apachectl -D DUMP_MODULES | grep cgi //确认加载了cgi模块
ls /usr/local/httpd/modules/ | grep cgi //确认是否编译过cgi模块
vi /usr/local/httpd/conf/httpd. conf //手动加载
LoadModule cgid_module modules/mod_cgid. so
LoadModule cgi_module modules/mod_cgi. so
apachectl -D DUMP_MODULES | grep cgi //确认加载了cgi模块
ls /usr/local/httpd/modules/ | grep cgi //确认是否编译过cgi模块
vi /usr/local/httpd/conf/httpd. conf //手动加载
LoadModule cgid_module modules/mod_cgid. so
LoadModule cgi_module modules/mod_cgi. so
1.修改配置参数
vi /usr/local/httpd/conf/extra/httpd-default.conf
vi /usr/local/httpd/conf/httpd.conf //保证里面的include文件启用default文件
Include conf/extra/httpd-default.conf //去掉#注释
2.重启Apache服务
systemctl stop httpd
systemctl start httpd
systemctl status httpd
netstat -anpt | grep httpd
curl http://localhost // 查看是否有默认网页
<html><body><h1>It works!</h1></body></html>
关闭防火墙
systemctl stop firewalld
setenforce 0
打开网页并进行抓包验证
cd /usr/local/httpd/logs
tail -5 access_log //查看访问日志文件
禁止访问控制实验步骤 方法一:
vi /etc/httpd.conf
禁止192.168.10.1的主机访问站点下的主页
重启服务
打开浏览器进行查看
查看日志
cd /usr/local/httpd/logs
tail -5 error_log //查看日志,显示被拒绝
禁止访问控制方法二:
1.修改配置文件
vi /etc/httpd.conf
<RequireAll>
Require all granted
Require not ip 192.168.10.1/32
<RequireAll>
2.重启服务并进行验证
systemctl stop httpd
systemctl start httpd
vi /etc/httpd.conf //更改ServerName
cd
htpasswd -c /usr/local/httpd/conf/.awspwd jam
New password:
Re-type new password:
Adding password for user jam
cat /usr/local/httpd/conf/.awspwd
jam:$apr1$JYx5Cdb4$riP3Lhf.fmKaKUU7ygC8W1
vi /etc/httpd.conf
添加配置文件,并注释#Require all granted
systemctl stop httpd
systemctl start httpd
httpd -t
Syntax OK
vi /etc/hosts
domin6
192.168.10.10 www.aa.com
登陆后可正常访问
crotatelogs日志分割实验步骤
vi /etc/httpd.conf
tar -zxvf cronolog-1.6.2.tar.gz
cd cronolog-1.6.2/
./configure
make && make install
cd
which cronolog
/usr/local/sbin/cronolog
vi /etc/httpd.conf
cd /usr/local/httpd/logs
ls -lh
对产生的日志进行分割
AWstats日志分析软件实验
apachectl -D DUMP_MODULES | grep cgi
cd /usr/local/httpd/modules/
ls /usr/local/httpd/modules/ | grep cgi
tar -zxvf awstats-7.6.tar.gz
mv awstats-7.6 /usr/local/awstats
vi /etc/hosts //本地建映射记录
vi /etc/httpd.conf
chown -R root.root awstats //更改属主和属组
cd tools
./awstats_configure.pl //进入配置文件
生成awstats的访问路径
vi /etc/awstats/awstats.www.aa.com.conf
mkdir /var/lib/awstats
systemctl stop httpd
systemctl start httpd
./awstats_updateall.pl now
systemctl stop httpd
systemctl start httpd
访问主页后重新刷新
网页单独分离
cd /usr/local/httpd/htdocs
vi xin.html
<html>
<head>
<meta http-equiv=refresh content="0;url=http://192.168.74.20/awstats/awstats.pl?config=www.aa.com">
</head>
<body></body>
</html>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。