<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OurApache &#187; ip</title>
	<atom:link href="http://ourapache.com/archives/tag/ip/feed" rel="self" type="application/rss+xml" />
	<link>http://ourapache.com</link>
	<description>我们致力于一个Apache知识的分享网站</description>
	<lastBuildDate>Tue, 13 Apr 2010 05:18:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>apache限制并发数,IP,带宽设置</title>
		<link>http://ourapache.com/archives/128</link>
		<comments>http://ourapache.com/archives/128#comments</comments>
		<pubDate>Tue, 10 Feb 2009 07:53:17 +0000</pubDate>
		<dc:creator>OurApache</dc:creator>
				<category><![CDATA[Apache高级应用]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[宽带]]></category>
		<category><![CDATA[并发数]]></category>

		<guid isPermaLink="false">http://www.ourapache.com/?p=128</guid>
		<description><![CDATA[apache限制并发数,IP,带宽设置]]></description>
			<content:encoded><![CDATA[<div id="read_tpc" class="tpc_content">apache限制并发数,<a href="http://ourapache.com/archives/tag/ip" class="st_tag internal_tag" rel="tag" title="标签 ip 下的日志">IP</a>,带宽设置<br />
限制并发数<br />
下载模块： </p>
<p>到官方网址： http://www.nowhere-land.org/programs/mod_vhost_limit/下载模块</p>
<p>http://www.nowhere-land.org/programs/mod_vhost_limit/mod_vhost_limit-0.4.tar.gz</p>
<p>安装：<br />
apxs -c mod_vhost_limit.c -o /path/to/libexec/mod_vhost_limit.so</p>
<p>在 <a href="http://ourapache.com/archives/tag/httpdconf" class="st_tag internal_tag" rel="tag" title="标签 httpd.conf 下的日志">httpd.conf</a> 加入：</p>
<p>LoadModule vhost_limit_module libexec/mod_vhost_limit.so<br />
AddModule mod_vhost_limit.c</p>
<p><a href="http://ourapache.com/archives/tag/%e9%85%8d%e7%bd%ae" class="st_tag internal_tag" rel="tag" title="标签 配置 下的日志">配置</a>：</p>
<p>MaxClients 150<br />
ExtendedStatus On</p>
<p>NameVirtualHost *<br />
ServerName server1<br />
DocumentRoot /some/where/1<br />
MaxVhostClients 100<br />
ServerName server2<br />
DocumentRoot /some/where/2<br />
MaxVhostClients 30<br />
ServerName server3<br />
DocumentRoot /some/where/3</p>
<p>其中： server1 被限制为 100 个并发线程数。 server2 被限制为 30 个并发线程数。 server3 没有被限制。</p>
<p>注：需 mod_status 的 ExtendedStatus On 支持！！</p>
<p>如超出限制的并发数在客户端就会出现503错误</p>
<p>———————————————————————————————-</p>
<p>限制IP连接数</p>
<p>到这里下载模块 http://dominia.org/djao/limit/mod_limitipconn-0.04.tar.gz</p>
<p>安装:<br />
tar zxvf mod_limitipconn-0.04.tar.gz<br />
cd mod_limitipconn-0.04<br />
make APXS=/usr/local/apache/bin/apxs ß—–这里要按你自己的路径设置<br />
make install APXS=/usr/local/apache/bin/apxs ß—–这里要按你自己的路径设置</p>
<p>编辑httpd.conf<br />
添加<br />
全局变量:<br />
&lt; IfModule mod_limitipconn.c &gt;<br />
&lt; Location / &gt; # 所有虚拟主机的/目录<br />
MaxConnPerIP 3 # 每IP只允许3个并发连接<br />
NoIPLimit image/* # 对图片不做IP限制<br />
&lt; /Location &gt;</p>
<p>&lt; Location /mp3 &gt; # 所有主机的/mp3目录<br />
MaxConnPerIP 1 # 每IP只允许一个连接请求<br />
OnlyIPLimit audio/mpeg video # 该限制只对视频和音频格式的文件<br />
&lt; /Location &gt;<br />
&lt; /IfModule &gt;</p>
<p>或者虚拟主机的:<br />
&lt; VirtualHost xx.xxx.xx.xx &gt; ##ip 地址<br />
ServerAdmin easy@phpv.net<br />
DocumentRoot /home/easy<br />
ServerName www.phpv.net<br />
&lt; IfModule mod_limitipconn.c &gt;<br />
&lt; Location / &gt;<br />
MaxConnPerIP 5<br />
NoIPLimit image/*<br />
&lt; /Location &gt;<br />
&lt; Location /mp3 &gt; # 所有主机的/mp3目录<br />
MaxConnPerIP 2 # 每IP只允许一个连接请求<br />
OnlyIPLimit audio/mpeg video # 该限制只对视频和音频格式的文件<br />
&lt; /Location &gt;<br />
&lt; /IfModule &gt;<br />
&lt; /VirtualHost &gt;</p>
<p>———————————————————————————————-</p>
<p>限制带宽：</p>
<p>下载模块 ftp://ftp.cohprog.com/pub/apache/module/1.3.0/mod_bandwidth.c<br />
安装:<br />
/usr/local/apache/bin/apxs -c ./mod_bandwidth.c -o /usr/local/apache/libexec/mod_bandwidth.so</p>
<p>&lt;——-以上/usr/local/apache请设置为你的路径</p>
<p>编辑httpd.conf<br />
添加：<br />
LoadModule bandwidth_module libexec/mod_bandwidth.so<br />
AddModule mod_bandwidth.c</p>
<p>重启你的apache</p>
<p>相关文档：</p>
<p>Global configuration directives :</p>
<p>BandWidthDataDir<br />
Syntax : BandWidthDataDir<br />
Default : “/tmp/apachebw”<br />
Context : server config<br />
Sets the name of the root directory used by mod_bandwidth to store its internal temporary information. Don’t forget to create the needed directories : /master and /link</p>
<p>BandWidthModule<br />
Syntax : BandWidthModule</p></div>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li>2009年02月7号 -- <a href="http://ourapache.com/archives/92" title="在Apache下限制每个虚拟主机的并发数">在Apache下限制每个虚拟主机的并发数</a></li><li>2008年12月27号 -- <a href="http://ourapache.com/archives/9" title="apache禁止使用IP访问的实现方法">apache禁止使用IP访问的实现方法</a></li></ul>
	标签：<a href="http://ourapache.com/archives/category/advanced" title="Apache高级应用" rel="tag">Apache高级应用</a>, <a href="http://ourapache.com/archives/tag/ip" title="ip" rel="tag">ip</a>, <a href="http://ourapache.com/archives/tag/%e5%ae%bd%e5%b8%a6" title="宽带" rel="tag">宽带</a>, <a href="http://ourapache.com/archives/tag/%e5%b9%b6%e5%8f%91%e6%95%b0" title="并发数" rel="tag">并发数</a><br />
]]></content:encoded>
			<wfw:commentRss>http://ourapache.com/archives/128/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache禁止使用IP访问的实现方法</title>
		<link>http://ourapache.com/archives/9</link>
		<comments>http://ourapache.com/archives/9#comments</comments>
		<pubDate>Sat, 27 Dec 2008 15:27:55 +0000</pubDate>
		<dc:creator>OurApache</dc:creator>
				<category><![CDATA[Apache初级应用]]></category>
		<category><![CDATA[httpd.conf]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[虚拟主机]]></category>
		<category><![CDATA[配置]]></category>

		<guid isPermaLink="false">http://www.ourapache.com/?p=9</guid>
		<description><![CDATA[用apache搭建的WEB服务器，如何让用户只能通过设定的域名访问，而不能直接通过服务器的IP地址访问呢？]]></description>
			<content:encoded><![CDATA[<p>用apache搭建的WEB服务器，如何让用户只能通过设定的域名访问，而不能直接通过服务器的IP地址访问呢？百度了一下有几个方法,没有试验过.</p>
<p>方法一：在httpd.conf文件最后面，加入以下代码<br />
NameVirtualHost 221.*.*.*<br />
ServerName 221.*.*.*<br />
Order Allow,Deny<br />
Deny from all<br />
DocumentRoot “c:/web”<br />
ServerName www.xxx.com<br />
　　　　　<br />
说明：蓝色部分是实现拒绝直接通过221.*.*.*这个IP的任何访问请求，这时如果你用221.*.*.*访问，会提示拒绝访问。红色部分就是允许通过www.xxx.com这个域名访问，主目录指向c:/web（这里假设你的网站的根目录是c:/web）</p>
<p>方法二：在httpd.conf文件最后面，加入以下代码<br />
NameVirtualHost 221.*.*.*<br />
DocumentRoot “c:/test”<br />
ServerName 221.*.*.*<br />
DocumentRoot “c:/web”<br />
ServerName www.xxx.com<br />
说明：蓝色部分是把通过221.*.*.*这个IP直接访问的请求指向c:/test目录下，这可以是个空目录，也可以在里面建一个首页文件，如index.hmtl，首面文件内容可以是一个声明，说明不能通过IP直接访问。红色部分的意思跟方法一是一样的。<br />
注：修改后要重启apache</p>
<p>方法三：建一个虚拟主机，<br />
ServerName IPAddress (比如192.168.0.1)<br />
DocumentRoot /usr/local/apache/nosite/<br />
这样就可以了。<br />
在/usr/local/apache/nosite/下面建一个index.htm，提示用户，不允许IP访问。或其它出错信息。<br />
方法四：<br />
ServerName IPAddress (比如192.168.0.1)<br />
DocumentRoot /usr/local/apache/nosite/<br />
Order deny,allow<br />
Deny from all</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li>2009年01月22号 -- <a href="http://ourapache.com/archives/66" title="Apache配置文件(httpd.conf)中文说明">Apache配置文件(httpd.conf)中文说明</a></li><li>2010年03月9号 -- <a href="http://ourapache.com/archives/318" title="Apache2中俩种设置PHP的异同">Apache2中俩种设置PHP的异同</a></li><li>2009年02月26号 -- <a href="http://ourapache.com/archives/184" title="Apache日志文件（配置和管理）">Apache日志文件（配置和管理）</a></li><li>2009年02月25号 -- <a href="http://ourapache.com/archives/170" title="Apache 两种虚拟主机方式的区别">Apache 两种虚拟主机方式的区别</a></li><li>2009年02月22号 -- <a href="http://ourapache.com/archives/161" title="在Windows上手动配置Apache下面的虚拟主机站点">在Windows上手动配置Apache下面的虚拟主机站点</a></li><li>2009年02月10号 -- <a href="http://ourapache.com/archives/128" title="apache限制并发数,IP,带宽设置">apache限制并发数,IP,带宽设置</a></li><li>2009年02月10号 -- <a href="http://ourapache.com/archives/123" title="Apache高级配置中文详解">Apache高级配置中文详解</a></li><li>2009年02月7号 -- <a href="http://ourapache.com/archives/92" title="在Apache下限制每个虚拟主机的并发数">在Apache下限制每个虚拟主机的并发数</a></li><li>2008年12月27号 -- <a href="http://ourapache.com/archives/7" title="apache中.htaccess的功能及写法">apache中.htaccess的功能及写法</a></li><li>2008年12月27号 -- <a href="http://ourapache.com/archives/3" title="apache的配置优化">apache的配置优化</a></li></ul>
	标签：<a href="http://ourapache.com/archives/category/primary" title="Apache初级应用" rel="tag">Apache初级应用</a>, <a href="http://ourapache.com/archives/tag/httpdconf" title="httpd.conf" rel="tag">httpd.conf</a>, <a href="http://ourapache.com/archives/tag/ip" title="ip" rel="tag">ip</a>, <a href="http://ourapache.com/archives/tag/%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba" title="虚拟主机" rel="tag">虚拟主机</a>, <a href="http://ourapache.com/archives/tag/%e9%85%8d%e7%bd%ae" title="配置" rel="tag">配置</a><br />
]]></content:encoded>
			<wfw:commentRss>http://ourapache.com/archives/9/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

