Apache 2.2 的internal dummy connection 問題

转自:http://www.copy-left.net/index.php?itemid=284

 
  查看apache2的日志,发现有大量
::1 - - [25/Dec/2009:13:07:51 +0800] "GET / HTTP/1.0" 302 - "-" "Apache/2.2.6 (Unix) PHP/5.2.9 (internal dummy connection)"
   
     查看Apache 官方的說明如下:
"When Apache HTTP Server manages its child processes, it needs a way to wake up processes that are listening for new connections. To do this, it sends a simple HTTP request back to itself... These requests are perfectly normal and you do not, in general, need to worry about them. They can simply be ignored.
    原来是http的子进程的缘故,internal dummy connection是因为apache使用了prefork方式,若用worker 则不会使用pop(pipe of death)在进程间通信,就不会出现internal dummy connections了。
 
解決的方式:
1. 減少它發生的機會(修改 /etc/apache2/apach2.conf),找到 IfModule mpm_worker_module 這一段:
StartServers 15
MinSpareServers 5
MaxSpareServers 20
MaxClients 150
MaxRequestsPerChild 0
     增加 MaxSpareServers 的數量(請依您 server 的連線狀況來做調整),這個可以減少它發生的機率。但是这个方法不可取,视服务器的配置而定,若太高服务器会down掉。
 
2. 減少發生還是會發生,所以把這 Request 導到一個固定的網頁:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^.*internal/ dummy/ connection.*$ [NC]
RewriteRule ^/$ /blank.html [L]
 
3. 不要把這資訊寫到 log 裡:
SetEnvIf Remote_Addr "::1" dontlog
CustomLog /var/log/httpd/access.log combined env=!dontlog
 
屏蔽"::1",可以过滤字符,不写入log中。
 
 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值