<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[沧海一粟]]></title> 
<link>http://www.dzhope.com/index.php</link> 
<description><![CDATA[Web系统架构与服务器运维,php开发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[沧海一粟]]></copyright>
<item>
<link>http://www.dzhope.com/post//</link>
<title><![CDATA[Apache 1.3 限制并发连接]]></title> 
<author>jed &lt;jed521@163.com&gt;</author>
<category><![CDATA[服务器技术]]></category>
<pubDate>Thu, 19 Apr 2007 00:27:30 +0000</pubDate> 
<guid>http://www.dzhope.com/post//</guid> 
<description>
<![CDATA[ 
	Apache 1.3 限制并发连接<br/><br/> <br/><br/>由于网站内容有很多下载，而大家一般使用flasget下载，一般使用多线程，同时有很多人在大量下载资料的话，就会形成并发连接饱和，后面的人就无法下载使用了。<br/><br/>这个问题一直困扰我们。<br/><br/>解决的思路应该有两个方面，一个是限制单ip的并发连接。一个是增加服务器并发连接的容量。目前服务器默认是1024个连接，还不会增加。<br/><br/>关于限制并发的问题，经过多次测试，基本解决了apache 1.3 限制并发连接的问题。<br/><br/>http://www.gknw.net/development/apache/apache-1.3/win32/modules/<br/><br/>从这里下载：<br/><br/>mod_limitipconn-0.04-w32.zip <br/><br/>解压后，其中 有些说明文件。<br/><br/>有 mod_limitipconn.so 文件，拷贝文件到 apache 的 modules 目录下。<br/><br/> <br/><br/>1、编辑 &nbsp;httpd.conf<br/><br/>在相应位置，增加<br/><br/>LoadModule limitipconn_module modules/mod_limitipconn.so<br/><br/>AddModule mod_limitipconn.c<br/><br/> <br/><br/>2、在AddModule mod_limitipconn.c 后面，即增加 mod设置：<br/><br/># Configuration for mod_limitipconn<br/><br/>&lt;IfModule mod_limitipconn.c&gt;<br/><br/> &nbsp; &nbsp;&lt;Location /somewhere&gt;<br/><br/> &nbsp; &nbsp; &nbsp; &nbsp; MaxConnPerIP 3<br/><br/> &nbsp; &nbsp; &nbsp; &nbsp; # exempting images from the connection limit is often a good<br/><br/> &nbsp; &nbsp; &nbsp; &nbsp; # idea if your web page has lots of inline images, since these<br/><br/> &nbsp; &nbsp; &nbsp; &nbsp; # pages often generate a flurry of concurrent image requests<br/><br/> &nbsp; &nbsp; &nbsp; &nbsp; NoIPLimit image/*<br/><br/> &nbsp; &nbsp;&lt;/Location&gt;<br/><br/> <br/><br/> &nbsp; &nbsp;&lt;Location /mp3&gt;<br/><br/> &nbsp; &nbsp; &nbsp; &nbsp; MaxConnPerIP 1<br/><br/> &nbsp; &nbsp; &nbsp; &nbsp;# In this case, all MIME types other than audio/mpeg and video*<br/><br/> &nbsp; &nbsp; &nbsp; &nbsp; # are exempt from the limit check<br/><br/> &nbsp; &nbsp; &nbsp; &nbsp; OnlyIPLimit audio/mpeg video<br/><br/> &nbsp; &nbsp;&lt;/Location&gt;<br/><br/>&lt;/IfModule&gt;<br/><br/># End of mod_limitipconn.<br/><br/> <br/><br/>3、设置<br/><br/>ExtendedStatus On<br/><br/> <br/><br/>4、在这里一般以为就可以了，结果出现严重错误，apache无法启动。<br/><br/>错误是：<br/><br/>The Apache service named D:&#92;Server&#92;Apache&#92;Apache.exe reported the following error:<br/><br/>&gt;&gt;&gt; Invalid command &#039;ExtendedStatus&#039;, perhaps mis-spelled or defined by a module not included in the server configuration &lt;&lt;&lt;<br/><br/> before the error.log file could be opened.<br/><br/> More information may be available in the error.log file. &nbsp; . <br/><br/> <br/><br/>通过搜索，发现是因为mod_status模块 没有加载的缘故。<br/><br/>通过loadModule 和 downmodule 加载 mod_status模块。<br/><br/>重新启动apahce，解决问题。<br/><br/> <br/><br/>5、如果要看 access文件，可以修改：<br/><br/># Optional supress logging of denied access<br/><br/>CustomLog logs/access_log common env=!LIMITIP<br/><br/> <br/><br/>6、控制特殊文件的下载：<br/><br/>AddType application/x-rar .rar .iso #添加自定义minetype，控制iso和rar的下载<br/><br/> <br/><br/>&lt; IfModule mod_limitipconn.c &gt;<br/>&lt; Location / &gt;<br/>MaxConnPerIP 5 <br/>NoIPLimit image/*<br/>&lt; /Location &gt;<br/><br/>&lt; Location /upload &gt; <br/>MaxConnPerIP 1 #upload文件夹限制下载<br/>OnlyIPLimit audio/mpeg video/* application/x-rar #只对音频视频文件，自定义 minetype文件起作用<br/>&lt; / Location &gt;<br/>&lt; / IfModule &gt; <br/>
]]>
</description>
</item><item>
<link>http://www.dzhope.com/post//#blogcomment</link>
<title><![CDATA[[评论] Apache 1.3 限制并发连接]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.dzhope.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>