比如说用了阿里云的slb ,然后他会检测服务器是否正常运行,通常会发大量的HEAD 请求过来。

这样有规则的请求是可以屏蔽的。步骤如下:

  1. 在 <Directory />中添加 SetEnvIf Request_Method HEAD dontlog
  2. CustomLog 中修改成 CustomLog logs/access_log combined env=!dontlog
  3. reload 即可。

可参考http://www.howtoforge.com/setenvif_apache2

官网http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html

不只是Request_Method 还有其他变量也可以进行判断

  • Host
  • User-Agent
  • Referer
  • Accept-Language
  • Remote_Host: the hostname (if available) of the client making the request.
  • Remote_Addr: the IP address of the client making the request.
  • Server_Addr: the IP address of the server on which the request was received (only with versions later than 2.0.43).
  • Request_Method: the name of the method being used (GET, POST, etc.).
  • Request_Protocol: the name and version of the protocol with which the request was made (e.g., "HTTP/0.9", "HTTP/1.1", etc.).
  • Request_URI: the resource requested on the HTTP request line - generally the portion of the URL following the scheme and host portion without the query string.

nginx 里面就简单一些

if ( $request_method = "HEAD" )

{

  access_log off ;

}

最新文章

  1. 系统吞吐量(TPS)、用户并发量、性能测试概念和公式
  2. struts2笔记4
  3. Ubuntu及Windows ADB设备no permissions的解决方案
  4. java web中Jdbc访问数据库步骤通俗解释(吃饭),与MVC的通俗解释(做饭)
  5. 网络操作与AFNetworking
  6. 获取UIButton的一些属性
  7. zoj 2156 - Charlie&amp;#39;s Change
  8. 苹果4S
  9. CSS学习笔记08 浮动
  10. docke镜像上传到dockerhub仓库和阿里云docker仓库的方法
  11. 7. ZooKeeper的stat结构
  12. java配置context.xml文件
  13. mongodb 集群分片
  14. ZYNQ EMIO使用及可重用封装
  15. WIN10 困扰多时的屏幕亮度 终于可以调节了-完美 -更新2018年2月28日
  16. DRP端口描述
  17. xss基础
  18. jQuery预览图
  19. Git:远程仓库的使用
  20. Yii2 cache的用法(1)

热门文章

  1. 二、Go语言开发环境安装与编写第一个Hello World
  2. Centos 7服务器搭建MySQL(mariadb)服务
  3. 关于用C-free进行C语言编程在电脑中生成的.exe和.o文件
  4. 【React踩坑记三】React项目报错Can't perform a React state update on an unmounted component
  5. Retrofit的文件上传和进度提示
  6. bind()函数的深入理解及两种兼容方法分析
  7. Openstack HA集群5-Keystone HA
  8. CF--思维练习--CodeForces - 216C - Hiring Staff (思维+模拟)
  9. CodeForces - 1047B Cover Points
  10. P1518 两只塔姆沃斯牛 The Tamworth Two(简单的搜索题)