我也来原创一下,
今天出现了apache打开速度爆慢的问题。检查如下:
[quote:79e7fc20a9]ping 的平均时间为 69 ms
find /-ctime 1 没有什么大的变动
netstat -anlp | grep 80 | grep tcp | awk {'print $5'} | awk -F: {'print $1'}| sort |uniq -c | sort -nr 有将近145个httpd 的链接, 前几个的每个ip的连接数目都在 10-15左右。[/quote:79e7fc20a9]
升级apache到2.0.50
[code:1:79e7fc20a9]$ ./configure --enable-so --enable-speling --enable-rewrite --enable-ssl --with-ssl=/usr/local/ssl
$ make
$ apachectl stop
$ make install
$ apachectl start[/code:1:79e7fc20a9]
问题依然存在。 查看last 和 apache的log文件,并用SSS扫描主机,未发现侵入和漏洞。于是搜索CU上的问题,发现了这个帖子,根据里面的解释,可能是由于我的服务器的hosts太多,从而正常连接数目在不停地增大,而httpd.conf里面没有恰当设置 <strong>MAX CLIENT</strong> 造成的。
修改了 httpd.conf 里面的 MAX CLIENT 为 256,问题解决!
如果你要继续增加 MAX CLIENT 的数量,当你将 MAX CLIENT 设置为超过256的时候,会出现
[quote:79e7fc20a9]WARNING: MaxClients of 1250 exceeds ServerLimit value of 256 servers,
lowering MaxClients to 256. To increase, please see the ServerLimit
directive.[/quote:79e7fc20a9]
的错误。
查看prefork 的相关说明,将idle的进程减少了。
(因为在我的 # apachectl -l 只有 prefork.c
[quote:79e7fc20a9]MaxSpareServers 6[/quote:79e7fc20a9]
原因2 百度的 mp3 搜索器搞的鬼
[quote:79e7fc20a9]210.54.49.45 - - [13/Jul/2004:13:37:23 +0800] "GET /archives/images/jiangnan.mp3 HTTP/1.1" 206 "http://list.mp3.baidu.com/topso/9/984_tsomp3.htm" "Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)"[/quote:79e7fc20a9]
原来是我的“江南”这首歌,被百度搜索到,不停的被下载。而且就是今天的事情。
查看流量日志
[quote:79e7fc20a9]2004年 七月 12 21 40 149 228.94 M字节
2004年 七月 13 17 25 8821 50.78 G字节 [/quote:79e7fc20a9]
所以利用阻止图片盗链的方法,在apache里面设置。
[quote:79e7fc20a9]<FilesMatch "\.(png|gif|jpg|mp3)">
Order Allow,Deny
Allow from env=local_ref
</FilesMatch>[/quote:79e7fc20a9]
重启apache以后立刻速度爆增!
[quote:79e7fc20a9][Tue Jul 13 13:40:54 2004] [error] [client 61.176.103.33] client denied by server configuration: /home/kreny/mt/weblog/archives/images/jiangnan.mp3, referer: http://list.mp3.baidu.com/topso/9/984_tsomp3.htm[/quote:79e7fc20a9]
提问!
虽然阻止了下载,但是如何从tcp层上阻止这种盗链呢? 我的error以没几分钟一兆的速度爆增阿~~ 谢谢!