<?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>haohtml&#039;s blog &#187; apache</title>
	<atom:link href="http://blog.haohtml.com/tag/apache/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.haohtml.com</link>
	<description>haohtml&#039;s life and works</description>
	<lastBuildDate>Tue, 22 May 2012 04:57:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Apache下实现隐藏服务器名称</title>
		<link>http://blog.haohtml.com/archives/10761</link>
		<comments>http://blog.haohtml.com/archives/10761#comments</comments>
		<pubDate>Sun, 31 Jul 2011 03:18:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[服务器类]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://blog.haohtml.com/?p=10761</guid>
		<description><![CDATA[我这里用的是FreeBSD的操作系统的.用curl 命令查看文件头 为了安全起见,我们需要将FreeBSD字样及其它信息隐藏起来.操作如下: 在httpd.conf文件里添加以下两行 ServerTokens Prod ServerSignature Off 重启apache即可. 如图所示:<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Apache 的信息查看模块——Server-Status" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F1415&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10761">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4026369.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache 的信息查看模块——Server-Status</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="查看Apache并发请求数及其TCP连接状态[原创]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F3191&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10761">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4024969.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">查看Apache并发请求数及其TCP连接状态[原创]</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="怎么检查windows下apache加载的mpm模块是什么？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F7363&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10761">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4022697.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">怎么检查windows下apache加载的mpm模块是什么？</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="隐藏 Apache &amp; PHP 的版本号" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10605&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10761">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">隐藏 Apache &amp; PHP 的版本号</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>我这里用的是FreeBSD的操作系统的.用curl 命令查看文件头</p>
<p><a href="http://blog.haohtml.com/wp-content/uploads/2011/07/apache_hidden_os_name_0.jpg" rel="lightbox[10761]"><img class="aligncenter size-full wp-image-10764" title="apache_hidden_os_name_0" src="http://blog.haohtml.com/wp-content/uploads/2011/07/apache_hidden_os_name_0.jpg" alt="" width="429" height="125" /></a></p>
<p>为了安全起见,我们需要将FreeBSD字样及其它信息隐藏起来.操作如下:</p>
<p>在httpd.conf文件里添加以下两行</p>
<blockquote><p>ServerTokens Prod<br />
ServerSignature Off</p></blockquote>
<p>重启apache即可.<span id="more-10761"></span><!--more--></p>
<p>如图所示:</p>
<p><a href="http://blog.haohtml.com/wp-content/uploads/2011/07/apache_hidden_os_name.jpg" rel="lightbox[10761]"><img class="aligncenter size-full wp-image-10763" title="apache_hidden_os_name" src="http://blog.haohtml.com/wp-content/uploads/2011/07/apache_hidden_os_name.jpg" alt="" width="366" height="132" /></a></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Apache 的信息查看模块——Server-Status" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F1415&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10761">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4026369.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache 的信息查看模块——Server-Status</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="查看Apache并发请求数及其TCP连接状态[原创]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F3191&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10761">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4024969.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">查看Apache并发请求数及其TCP连接状态[原创]</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="怎么检查windows下apache加载的mpm模块是什么？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F7363&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10761">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4022697.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">怎么检查windows下apache加载的mpm模块是什么？</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="隐藏 Apache &amp; PHP 的版本号" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10605&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10761">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">隐藏 Apache &amp; PHP 的版本号</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.haohtml.com/archives/10761/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>隐藏 Apache &amp; PHP 的版本号</title>
		<link>http://blog.haohtml.com/archives/10605</link>
		<comments>http://blog.haohtml.com/archives/10605#comments</comments>
		<pubDate>Fri, 22 Jul 2011 17:05:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[服务器类]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://blog.haohtml.com/?p=10605</guid>
		<description><![CDATA[有朋友问起，如何隐藏 HTTP header 中发送包含在 Server 信息里面的 Apache 和 PHP 版本号（譬如我们可以到 Firefox 的附加工具里面找 Live HTTP Headers;还可以用curl -I IPaddress&#124;http://域名 ) 下面是做法： Apache: 打开 httpd.conf，在文件最后加入以下代码： #Hidden I can with apache version number ServerTokens ProductOnly ServerSignature Off PHP: 隐藏 PHP 版本就是隐藏类似于 "X-Powered-By: PHP/5.1.2-1+b1" 这个，开启 php.ini，加入: expose_php = Off 设置了expose_php=Off后,用phpinfo查看的时候,页面上原来正常显示的图片会消失隐藏的. 相关:http://blog.haohtml.com/archives/10761<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Apache内存优化" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F872&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache内存优化</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache 的信息查看模块——Server-Status" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F1415&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4026369.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache 的信息查看模块——Server-Status</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="查看Apache并发请求数及其TCP连接状态[原创]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F3191&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4024969.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">查看Apache并发请求数及其TCP连接状态[原创]</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="apache你必须知道的一些知识" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F4663&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">apache你必须知道的一些知识</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>有朋友问起，如何隐藏 HTTP header 中发送包含在 Server 信息里面的 Apache 和 PHP 版本号（譬如我们可以到 Firefox 的附加工具里面找 Live HTTP Headers;还可以用curl -I IPaddress|http://域名 ) 下面是做法：<br />
<strong>Apache:</strong><br />
打开 httpd.conf，在文件最后加入以下代码：</p>
<div>
<div id="code0">
<ol>
<li>#Hidden I can with apache version number</li>
<li>ServerTokens ProductOnly</li>
<li>ServerSignature Off</li>
</ol>
</div>
</div>
<p><strong>PHP:</strong><br />
隐藏 PHP 版本就是隐藏类似于 "X-Powered-By: PHP/5.1.2-1+b1" 这个，开启 php.ini，加入:</p>
<div>
<div id="code1">
<ol>
<li>expose_php = Off</li>
</ol>
</div>
</div>
<p>设置了expose_php=Off后,用phpinfo查看的时候,页面上原来正常显示的图片会消失隐藏的.</p>
<p><em>相关:<a href="http://blog.haohtml.com/archives/10761">http://blog.haohtml.com/archives/10761</a> </em></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Apache内存优化" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F872&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache内存优化</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache 的信息查看模块——Server-Status" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F1415&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4026369.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache 的信息查看模块——Server-Status</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="查看Apache并发请求数及其TCP连接状态[原创]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F3191&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4024969.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">查看Apache并发请求数及其TCP连接状态[原创]</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="apache你必须知道的一些知识" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F4663&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10605">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">apache你必须知道的一些知识</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.haohtml.com/archives/10605/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>统计apache日志中每日访问IP中访问量最多的100个IP</title>
		<link>http://blog.haohtml.com/archives/10383</link>
		<comments>http://blog.haohtml.com/archives/10383#comments</comments>
		<pubDate>Mon, 11 Jul 2011 16:52:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[服务器类]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[日志]]></category>

		<guid isPermaLink="false">http://blog.haohtml.com/?p=10383</guid>
		<description><![CDATA[统计apache日志中每日访问IP中访问量最大的100个IP地址 cat access.log &#124;awk ‘{print $1}’&#124;sort&#124;uniq -c&#124;sort -nr&#124;head -100 &#62; 37res.txt 来源:http://flychen.com/2011/06/statistics-apache-log-in-to-access-the-ip-to-access-the-daily-amount-of-up-to-100-ip<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="安装awstats来分析apache的访问日志" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F675&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10383">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4023171.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">安装awstats来分析apache的访问日志</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="apache的日志级别和设置" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9695&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10383">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">apache的日志级别和设置</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="查看Apache并发请求数及其TCP连接状态[原创]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F3191&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10383">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4024969.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">查看Apache并发请求数及其TCP连接状态[原创]</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache下实现隐藏服务器名称" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10761&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10383">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/31/20204251.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache下实现隐藏服务器名称</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>统计apache日志中每日访问IP中访问量最大的100个IP地址</p>
<blockquote><p>cat access.log |awk ‘{print $1}’|sort|uniq -c|sort -nr|head -100 &gt; 37res.txt</p></blockquote>
<p>来源:<a href="http://flychen.com/2011/06/statistics-apache-log-in-to-access-the-ip-to-access-the-daily-amount-of-up-to-100-ip">http://flychen.com/2011/06/statistics-apache-log-in-to-access-the-ip-to-access-the-daily-amount-of-up-to-100-ip</a></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="安装awstats来分析apache的访问日志" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F675&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10383">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4023171.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">安装awstats来分析apache的访问日志</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="apache的日志级别和设置" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9695&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10383">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">apache的日志级别和设置</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="查看Apache并发请求数及其TCP连接状态[原创]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F3191&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10383">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4024969.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">查看Apache并发请求数及其TCP连接状态[原创]</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache下实现隐藏服务器名称" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10761&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10383">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/31/20204251.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache下实现隐藏服务器名称</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.haohtml.com/archives/10383/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>定制与美化Apache的目录列表（索引）样式</title>
		<link>http://blog.haohtml.com/archives/10074</link>
		<comments>http://blog.haohtml.com/archives/10074#comments</comments>
		<pubDate>Tue, 28 Jun 2011 00:54:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[服务器类]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://blog.haohtml.com/?p=10074</guid>
		<description><![CDATA[表示开启了索引模式（也就是目录浏览） Options Indexes indexOptions FancyIndexing ScanHTMLTitles NameWidth=128 DescriptionWidth=256 HTMLTable VersionSort FoldersFirst 可用参数，含义如下： #ScanHTMLTitles:搜索HTML标题 #NameWidth:文件命显示字节数 #DescriptionWidth:描述显示字节数 #HTMLTable:允许HTML格式 #FoldersFirst:目录优先 SuppressLastModified 在目录中禁止显示最近的修改时间 #索引排除语法 IndexIgnore header.html footer.html header.html footer.html 这两个文件不会在索引（目录浏览）中出现。 #索引头部嵌入文件 HeaderName /data/index/header.html #索引底部嵌入文件 ReadmeName /data/index/footer.html ReadmeName： 指定该目录列表的footer模板，指定一个html文件后，Apache会在目录列表的底部加载这个网页。（注意：文件路径是相对于列表目录的根而言的，并不是相对于系统根或者网站根。） HeaderName： 指定该目录列表的header模板，指定一个html文件后，Apache会用这个网页替换掉默认目录列表上面呆板的Index of …..。（注意：文件路径是相对于列表目录的根而言的，并不是相对于系统根或者网站根。） #默认索引排序方式 IndexOrderDefault Ascending Date #关闭服务器标志 ServerSignature Off 经过测试，如果目录中含有中文文件或者中文目录的时候，在IE下显示乱码，于是在浏览器中查看其编码发现它默认使用ISO-8859-1编码，手动选择GB2312后就能正常显示。看来是ApacheIndexes在处理中文的时候的编码不正确。 　　仔细研究其说明文档，其中介绍，可以在Apache配置文件中为Indexes指定特定的编码，我们能够修改配置文件让其支持中文。具体办法如下： 　　在配置文件中添加： 　　IndexOptions Charset=GB2312 　　这样这样就能解决Apache autoindex模块中文乱码问题了。 ========================================================= Apache一目录索引显示风格定制 在Apache中有目录索引是由mod_autoindex模块负责完成的。它把当前目录结果转换成html页面。在默认情况下，有很多地方让人感觉不爽，比如文件名宽度太窄（只有可怜的23字节），图标太大，有点傻傻的，好多文件类型没有关联。幸好Apache开发人员早就想到这一点，提供了让用户定制的命令。官方详细介绍可以去上面的超链去看看。 索引风格控制命令： IndexOptions Directive //Dirctive 是命令选项，见下面实例 [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Apache下实现隐藏服务器名称" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10761&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10074">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/31/20204251.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache下实现隐藏服务器名称</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="查看Apache并发请求数及其TCP连接状态[原创]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F3191&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10074">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4024969.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">查看Apache并发请求数及其TCP连接状态[原创]</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache 的信息查看模块——Server-Status" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F1415&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10074">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4026369.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache 的信息查看模块——Server-Status</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache优化内存占用方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F870&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10074">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache优化内存占用方法</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p><strong>表示开启了索引模式（也就是目录浏览）</strong></p>
<blockquote><p>Options Indexes</p>
<p>indexOptions FancyIndexing ScanHTMLTitles NameWidth=128 DescriptionWidth=256 HTMLTable VersionSort FoldersFirst</p></blockquote>
<p><strong>可用参数，含义如下：</strong></p>
<blockquote><p>#ScanHTMLTitles:搜索HTML标题<br />
#NameWidth:文件命显示字节数<br />
#DescriptionWidth:描述显示字节数<br />
#HTMLTable:允许HTML格式<br />
#FoldersFirst:目录优先</p>
<p>SuppressLastModified 在目录中禁止显示最近的修改时间</p></blockquote>
<p><strong>#索引排除语法</strong></p>
<blockquote><p>IndexIgnore header.html footer.html</p></blockquote>
<p>header.html footer.html 这两个文件不会在索引（目录浏览）中出现。</p>
<p><strong>#索引头部嵌入文件</strong></p>
<blockquote><p><strong> </strong>HeaderName /data/index/header.html</p></blockquote>
<p><strong>#索引底部嵌入文件</strong></p>
<blockquote><p><strong> </strong>ReadmeName /data/index/footer.html</p></blockquote>
<p><span style="color: #0000ff;">ReadmeName</span>： 指定该目录列表的footer模板，指定一个html文件后，Apache会在目录列表的底部加载这个网页。（注意：文件路径是相对于列表目录的根而言的，并不是相对于系统根或者网站根。）<span id="more-10074"></span><br />
<span style="color: #0000ff;">HeaderName：</span> 指定该目录列表的header模板，指定一个html文件后，Apache会用这个网页替换掉默认目录列表上面呆板的Index of …..。（注意：文件路径是相对于列表目录的根而言的，并不是相对于系统根或者网站根。）</p>
<p><strong>#默认索引排序方式</strong></p>
<blockquote><p><strong> </strong>IndexOrderDefault Ascending Date</p></blockquote>
<p><strong>#关闭服务器标志</strong></p>
<blockquote><p>ServerSignature Off</p></blockquote>
<p><span><span>经过测试，如果目录中含有中文文件或者中文目录的时候，在IE下显示乱码，于是在浏览器中查看其编码发现它默认使用ISO-8859-1编码，手动选择GB2312后就能正常显示。看来是ApacheIndexes在处理中文的时候的编码不正确。</span></span></p>
<p><span><span>　　仔细研究其说明文档，其中介绍，可以在Apache配置文件中为Indexes指定特定的编码，我们能够修改配置文件让其支持中文。具体办法如下：</span></span></p>
<p><span><span>　　在配置文件中添加：</span></span></p>
<p><span style="color: #0000ff;">　　IndexOptions Charset=GB2312</span></p>
<p><span><span>　　这样这样就能解决Apache autoindex模块中文乱码问题了。</span></span></p>
<p>=========================================================</p>
<p><strong>Apache一目录索引显示风格定制</strong><br />
在Apache中有目录索引是由mod_autoindex模块负责完成的。它把当前目录结果转换成html页面。在默认情况下，有很多地方让人感觉不爽，比如文件名宽度太窄（只有可怜的23字节），图标太大，有点傻傻的，好多文件类型没有关联。幸好Apache开发人员早就想到这一点，提供了让用户定制的命令。官方详细介绍可以去上面的超链去看看。</p>
<p><strong>索引风格控制命令：</strong></p>
<blockquote><p><strong> </strong>IndexOptions Directive //Dirctive 是命令选项，见下面实例</p></blockquote>
<p>下面介绍常用的设置（都写在httpd.conf文件中）：<br />
修改自动目录索引的宽度<br />
缺省设置下，Apache默认每栏宽度是23字节，对于文件名来说，实在是太短了。一般要求60字节<br />
IndexOptions NameWidth=60</p>
<p><span style="color: #0000ff;">修改图标尺寸</span><br />
系统默认好像是24，经过试验，发现16的效果比较好。<br />
IndexOptions IconHeight=16<br />
IndexOptions IconWidth=16</p>
<p><span style="color: #0000ff;">目录优先</span><br />
系统默认是文件优先，和我们平时的习惯不一致。改过来。<br />
IndexOptions FoldersFirst</p>
<p><span style="color: #0000ff;">版本排序</span><br />
无须多说，加上吧。对于中文来说，是按照拼音顺序排序的。<br />
IndexOptions VersionSort</p>
<p><span style="color: #0000ff;">图标优化</span><br />
默认的图标有不少比较难看，而且还有很多文件类型就没有图标，由于Solaris不支持Microsoft定义的各种文档类型，显示这些文件时都用问号图标表达，或许代表Sun对Microsoft的态度，不过我可不这么认为，凡事还是清楚点好。<br />
定制文件图标分两步，先用图标工具抓取常用图标，象Word，Excel，Powerpint，Rar，Pdf。另外，默认的目录图标看上去也不爽，干脆把 Window的那套东西都搬过来。完成后，把这些图标（格式为gif或png）全部存到/usr/local/apache2/icons目录下。对于目录图标，我直接用微软的图标替换了那个名字叫folder.gif的文件。<br />
接下来，用AddIcon命令把图标和文件类型关联起来。<br />
AddIcon /icons/word.gif .doc .DOC<br />
AddIcon /icons/excel.gif .xls .XLS<br />
AddIcon /icons/rar.gif .rar .RAR<br />
AddIcon /icons/srm.gif .srm .SRM<br />
AddIcon /icons/powerpoint.gif .ppt .PPT<br />
AddIcon /icons/access.gif .mdb .MDB</p>
<p>上面是我喜欢的文件类型，注意可别忘了大小写都加上哦。<br />
完成后，重新启动apache，哈哈，终于看到了。可是，有几个类型还是没有显示出来L，它们是：rar,srm,mdb。<br />
又仔细分析了一下配置文件，发现可能和文件类型有关。<br />
Apache有一个专门负责文件类型的文件：mime.types，里面为每个文件进行了详细分类。比如有：application,image,audio,video。在里面狂搜了一遍，没有上面的那三个类型，于是在前面增加如下定义：</p>
<blockquote><p># MIME type Extensions<br />
application/winrar rar<br />
application/srm srm<br />
application/access mdb</p></blockquote>
<p>重新启动apache，OK。</p>
<p>Apache目录索引的简易配置<br />
使用Apache配置简易的目录索引，登录者可以方便浏览、下载目录之下的内容。</p>
<p><span style="color: #ff6600;">过程：(以下均为有root权限时的操作)</span></p>
<p>1.安装apache：pacman -S apache</p>
<p>2.配置apache：vi /etc/httpd/conf/httpd.conf</p>
<p>#管理员的E-mail，出错时发送错误的邮件地址</p>
<p>ServerAdmin [email]HeirJoe@gmail.com[/email]</p>
<p>#服务器名，没有域名就写IP</p>
<p>ServerName My IP:80</p>
<p>#主目录地址</p>
<p>DocumentRoot “/path/to/server”</p>
<p>#设置默认主目录的权限，下面需要用到</p>
<p>&nbsp;</p>
<p>Order deny,allow</p>
<p>Allow from all</p>
<p>&nbsp;</p>
<p>#使用别名，将系统绝对路径转换为相对于DocumentRoot的相对路径</p>
<p>Alias /home “/home/httpd”</p>
<p>#配置浏览目录的选项</p>
<p>&nbsp;</p>
<p>#选项为索引方式</p>
<p>Options Indexes</p>
<p>#索引选项，目录优先</p>
<p>IndexOptions FancyIndexing FoldersFirst</p>
<p>#索引排除选项</p>
<p>IndexIgnore header.html footer.html</p>
<p>#索引头部嵌入文件(只可使用相对http主目录的相对路径，而不是系统的绝对路径)</p>
<p>HeaderName /home/html/header.html</p>
<p>#索引底部嵌入的文件(同上，”/home”使用了别名,同时要为那个目录设置权限)</p>
<p>ReadmeName /home/html/footer.html</p>
<p>#关闭服务器标志</p>
<p>ServerSignature Off</p>
<p>#使用.htaccess文件可以得到的控制水平</p>
<p>AllowOverride None</p>
<p>#控制访问权限</p>
<p>Order allow,deny</p>
<p>Allow from all</p>
<p>&nbsp;</p>
<p>所作的修改就这么多，其它的都是系统默认，不考虑安全、性能等，基本能正常跑起来了。</p>
<p>3.运行apache：httpd -k start</p>
<p>简单的配置就这么多，Apache的配置和组合还有好多好多，以后再细细研究</p>
<p>个性化Apach2目录列表</p>
<p>个性化Apach2目录列表，主要取决于对modautoindex模块中的各种指令的使用和配合。可以去先阅读一下Apache2.0手册中的modautoindex模块文档。</p>
<p>文档地址： [url]http://httpd.apache.org/docs/2.0/mod/mod_autoindex.html[/url]</p>
<p>在开始之前，请看一个个性化目录列表的演示地址： [url]http://nanu.8866.org/download[/url]</p>
<p>下面，我们就开始动手：</p>
<p>一、修改httpd.conf文件</p>
<p>对需要个性化的目录进行定制：</p>
<p>&lt;Directory “/www/download”&gt;<br />
Options Indexes FollowSymlinks<br />
IndexOptions FancyIndexing ScanHTMLTitles NameWidth=25 DescriptionWidth=128 VersionSort FoldersFirst<br />
IndexIgnore favicon.ico header.html footer.html images<br />
HeaderName header.html<br />
ReadmeName footer.html<br />
AddDescription “Qmail安装包” qmail.tar.gz<br />
AddDescription “Putty0.58” putty.exe<br />
AddDescription “我的MSN头像:P” msn.gif<br />
IndexOrderDefault Ascending Name<br />
AllowOverride None<br />
Order allow,deny<br />
Allow from all<br />
&lt;/Directory&gt;</p>
<p>部分指令说明：</p>
<p>ScanHTMLTitles：如果目录中含有HTML文件，则Apache会自动读取HTML文件的&lt; title&gt;……部分，用HTML文件的标题作为Description（描述）显示在列表目录中的 Description部分。。（注意：加载该指令会加大CPU的负荷！）</p>
<p>NameWidth=25 ：指定目录列表可以显示最长为25字节的文件/目录名,如果使用*来做值,会自适应到最长文件名。</p>
<p>DescriptionWidth=128：指定目录列表可以显示最长为128字节的文件/目录描述内容。</p>
<p>VersionSort：如果目录中含有同一文件的不同版本，则Apache会对该文件按照版本号自动排序。</p>
<p>FoldersFirst：最先列出文件夹会使显示效果更好看一些吧！</p>
<p>IndexIgnore：在它后面设定的文件/目录不会在目录列表中显示。</p>
<p>HeaderName：指定该目录列表的header模板，指定一个html文件后，Apache会用这个网页替换掉默认目录列表上面呆板的 Index of …..而显示出个性化的头网页。（注意：文件路径是相对于列表目录的根而言的，并不是相对于系统根或者网站根而言的！）</p>
<p>ReadmeName：指定该目录列表的footer模板，指定一个html文件后，Apache会在目录列表的底部加载这个网页。（注意：文件路径是相对于列表目录的根而言的，并不是相对于系统根或者网站根而言的！）</p>
<p>AddDescription：如果你想为某个文件设置一个Description（描述）的话，就使用这个指令，格式是AddDescription “描述” 文件名 。</p>
<p>IndexOrderDefault Ascending Name：指定目录列表的排序方式为按名称排序。</p>
<p>当然，还可以定制很多其他的内容，包括可以为每一个文件设定一个图标等等，去读文档吧。</p>
<p>二、建立header.html和footer.html</p>
<p>这两个文件是列表目录的头网页和尾网页，也是个性化的关键。其实这部分和Apache水平已经没有什么关系了，主要还是看你制作网页水平如何了，呵呵。</p>
<p>这里给出两个文件的格式：</p>
<p>header.html：</p>
<p>&lt;!– 个性化内容开始 –&gt;<br />
可以在这里加入个性化内容，图片、FLASH、表格等等，随意啦！<br />
&lt;!– 个性化内容结束 –&gt;<br />
&lt;!– 嵌入列表目录 –&gt;<br />
&lt;table&gt;<br />
&lt;tr&gt;&lt;td&gt;<br />
footer.html：</p>
<p>&lt;/td&gt;&lt;/tr&gt;<br />
&lt;/table&gt;<br />
&lt;!– 目录列表嵌入结束 –&gt;<br />
&lt;!– 个性化内容开始 –&gt;<br />
可以在这里加入个性化内容，图片、FLASH、表格等等，随意啦！<br />
&lt;!– 个性化内容结束 –&gt;</p>
<p>可以看出，其实个性化的原理就是把Apache的目录列表嵌在了header.htm的&lt;\table&gt;&lt; \tr&gt;&lt;\td&gt;与footer.html的&lt;\/td&gt;&lt;\/tr&gt;&lt;\/table&gt;之间，两个文件的其他部分都可以自定义内容的。</p>
<p>建立好这两个文件后，就可以重启apache，看看自己的定制的目录有多漂亮吧！</p>
<p>&nbsp;</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Apache下实现隐藏服务器名称" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10761&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10074">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/31/20204251.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache下实现隐藏服务器名称</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="查看Apache并发请求数及其TCP连接状态[原创]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F3191&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10074">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4024969.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">查看Apache并发请求数及其TCP连接状态[原创]</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache 的信息查看模块——Server-Status" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F1415&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10074">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4026369.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache 的信息查看模块——Server-Status</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache优化内存占用方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F870&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10074">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache优化内存占用方法</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.haohtml.com/archives/10074/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>squid+apache使web加速</title>
		<link>http://blog.haohtml.com/archives/9876</link>
		<comments>http://blog.haohtml.com/archives/9876#comments</comments>
		<pubDate>Thu, 16 Jun 2011 07:03:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[系统架构]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Squid]]></category>

		<guid isPermaLink="false">http://blog.haohtml.com/?p=9876</guid>
		<description><![CDATA[一台web服务器，上面有好几个虚拟主机，近日装上Squid 2.6进行WEB加速，Squid 和Apache均在同一台服务器上面，效果非常明显 主机配置为： CPU: 至强2.8G  内存： 1GB RAM 下载： wget  http://www.squid-cache.org/Versions/v2/2.6/squid-2.6.STABLE6.tar.bz2 tar jxvf squid-2.6.STABLE6.tar.bz2 ./configure –prefix=/usr/local/squid --with-maxfd=65536 这个--with-maxfd参数是增大squid文件描述符到65536 安装完毕后开始配置/usr/local/squid/etc/squid.conf CODE: visible_hostname www.yoursite.com http_port xx.xx.xx.xx:80 vhost vport #xx.xx.xx.xx为这台服务器的IP地址 icp_port 0 cache_mem 400 MB #设置Squid所能使用的内存共400MB，这个值因人而异 cache_swap_low 90 cache_swap_high 95 maximum_object_'size' 20000 KB #最大缓存文件大小，超过这个值则不缓存，这个值因人而异 maximum_object_'size'_in_memory 4096 KB #装入内存缓存的文件大小，这个值对Squid的性能影响比较大，因为默认值是8K,超过8K的文件都不装入内存，而实际应用中很多网页和图片等都超过8KB, 个人认为如果缓存不装入内存而存在磁盘上，性能和apache直接读取磁盘文件没什么区别，甚至不如直接访问apache，现在设置成小于4兆的文件通通装入内存缓存. cache_dir ufs /tmp 10000 16 256 #磁盘缓存的类型和目录，大小，一二级目录的设置，这里磁盘缓存大小是10G cache_store_log none #这个设置是不记录store.log [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="freebsd7.0 apache php squid 反向代理" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F944&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9876">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4026062.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">freebsd7.0 apache php squid 反向代理</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="squid缓存动态连接" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10591&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9876">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/23/24353543.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">squid缓存动态连接</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="服务器的大用户量的承载方案 Nginx Squid Apache PHP MySQL" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F1349&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9876">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">服务器的大用户量的承载方案 Nginx Squid Apache PHP MySQL</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="apache squid 配置反向代理服务相关文章" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F5895&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9876">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">apache squid 配置反向代理服务相关文章</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>一台web服务器，上面有好几个虚拟主机，近日装上Squid 2.6进行WEB加速，Squid 和Apache均在同一台服务器上面，效果非常明显</p>
<p>主机配置为： CPU: 至强2.8G  内存： 1GB RAM</p>
<p>下载：</p>
<blockquote><p>wget  http://www.squid-cache.org/Versions/v2/2.6/squid-2.6.STABLE6.tar.bz2<br />
tar jxvf squid-2.6.STABLE6.tar.bz2<br />
./configure –prefix=/usr/local/squid --with-maxfd=65536</p></blockquote>
<p>这个--with-maxfd参数是增大squid文件描述符到65536</p>
<p>安装完毕后开始配置/usr/local/squid/etc/squid.conf</p>
<p><strong> </strong></p>
<p><strong>CODE:</strong></p>
<p>visible_hostname www.yoursite.com<br />
http_port xx.xx.xx.xx:80 vhost vport</p>
<p>#xx.xx.xx.xx为这台服务器的IP地址<span id="more-9876"></span></p>
<p>icp_port 0</p>
<p>cache_mem 400 MB</p>
<p>#设置Squid所能使用的内存共400MB，这个值因人而异</p>
<p>cache_swap_low 90<br />
cache_swap_high 95</p>
<p>maximum_object_'size' 20000 KB</p>
<p>#最大缓存文件大小，超过这个值则不缓存，这个值因人而异</p>
<p>maximum_object_'size'_in_memory 4096 KB</p>
<p>#装入内存缓存的文件大小，这个值对Squid的性能影响比较大，因为默认值是8K,超过8K的文件都不装入内存，而实际应用中很多网页和图片等都超过8KB, 个人认为如果缓存不装入内存而存在磁盘上，性能和apache直接读取磁盘文件没什么区别，甚至不如直接访问apache，现在设置成小于4兆的文件通通装入内存缓存.</p>
<p>cache_dir ufs /tmp 10000 16 256</p>
<p>#磁盘缓存的类型和目录，大小，一二级目录的设置，这里磁盘缓存大小是10G</p>
<p>cache_store_log none</p>
<p>#这个设置是不记录store.log</p>
<p>emulate_httpd_log on</p>
<p>#打开emulate_httpd_log选项,将使Squid仿照Aapche的日志格式</p>
<p>logformat combined %&gt;a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %&lt;st "%{Referer}&gt;h" "%{User-Agent}&gt;h" %Ss:%Sh</p>
<p>#日志格式combined的设置</p>
<p>pid_filename /var/log/squid/squid.pid<br />
cache_log /var/log/squid/cache.log<br />
access_log /var/log/squid/access.log combined</p>
<p>#这里是设置pid和日志文件的位置，因人而异，同时日志格式是combined，awstats可以直接调用分析了</p>
<p>acl all src 0.0.0.0/0.0.0.0</p>
<p>acl QUERY urlpath_regex cgi-bin .php .cgi .avi .wmv .rm .ram .mpg .mpeg .zip .exe<br />
cache deny QUERY</p>
<p>#设置不想缓存的目录或者文件类型</p>
<p>acl picurl url_regex -i \.bmp$ \.png$ \.jpg$ \.gif$ \.jpeg$<br />
acl mystie1 referer_regex -i aaa<br />
http_access allow mystie1 picurl<br />
acl mystie2 referer_regex -i bbb<br />
http_access allow mystie2 picurl</p>
<p>#设置防图片盗链的，其中aaa,和bbb分别是虚拟主机的域名，referer中必须包含有aaa或者bbb的域名才能访问图片</p>
<p>acl nullref referer_regex -i ^$<br />
http_access allow nullref<br />
acl hasref referer_regex -i .+<br />
http_access deny hasref picurl</p>
<p>#设置允许直接访问图片和拒绝referer中没有包含aaa或着bbb的访问图片</p>
<p>cache_peer xx.xx.xx.xx parent 80 0 no-query originserver login=PASS</p>
<p>#xx.xx.xx.xx还是本机服务器的IP，80则是apache的端口，如果你的虚拟主机有用户名和密码保护起来的目录必须设置login=PASS，否则认证会失效</p>
<p>cache_effective_user nobody<br />
cache_effective_group nobody</p>
<p>#squid使用的用户组和用户名<br />
squid配置完成！</p>
<p>建立缓存和日志目录，并改变权限使squid能写入<br />
mkdir /tmp<br />
mkdir /var/log/squid<br />
chown -R nobody:nobody /tmp<br />
chmod 777 /tmp<br />
chown -R nobody:nobody /var/log/squid<br />
－－－－－－－－－－－－－－－－－－－－－－－<br />
Apache需要改动的配置</p>
<p><strong>CODE:</strong></p>
<p>Port 80</p>
<p>#要把端口改为80</p>
<p>NameVirtualHost xx.xx.xx.xx:80<br />
#本台主机IP和端口</p>
<p>虚拟主机配置<br />
&lt;VirtualHost xx.xx.xx.xx&gt;<br />
ServerAdmin xxx@yahoo.com<br />
DocumentRoot /home/aaa/www<br />
ServerName aaa.com<br />
ServerAlias www.aaa.com<br />
ScriptAlias /cgi-bin/ "/home/aaa/cgi-bin/"<br />
&lt;Directory /&gt;<br />
Options Includes FollowSymLinks<br />
AllowOverride All<br />
&lt;/Directory&gt;<br />
&lt;/VirtualHost&gt;</p>
<p>如果还有别的虚拟主机请参照上面设置<br />
---------------------------------------------------------</p>
<p>重启apache : apachectl restart</p>
<p>----------------------------------------------------------<br />
首次运行squid要先建立缓存</p>
<p>/usr/local/squid/sbin/squid -z</p>
<p>启动squid</p>
<p>echo "65535" &gt; /proc/sys/fs/file-max<br />
ulimit -HSn 65535<br />
/usr/local/squid/sbin/squid</p>
<p>大家最好把这几句话放到squid启动脚本里面，这样才会获得65536文件描述符</p>
<p>最好还编辑/etc/hosts 文件<br />
添加以下内容</p>
<p>xx.xx.xx.xx aaa.com www.aaa.com bbb.com www.bbb.com</p>
<p>这样免去查询DNS，速度也快一些</p>
<p>现在大家肯定急着要打开浏览器访问你的网站看看效果吧，其实没啥变化，要等到有流量访问，squid把文件都装到内存后，效果才明显。可以用top命令观察squid的内存使用情况或者用</p>
<p>cat /var/log/squid/access.log |grep TCP_MEM_HIT</p>
<p>如果看到很多的<strong>TCP_MEM_HIT</strong> ，这表明该文件是从内存缓存读取的，squid已经起作用了！你再用浏览器打开该文件，应该是快如闪电了。。呵呵，大功告成了！还有其他类型的HIT，如TCP_HIT等等，这些是从磁盘读取的，我觉得加速的意义不大，只不过缓解了apache的压力而已。</p>
<p>后记： 我的服务器因流量很大，大多都是静态的网页，日访问量常常上10W, apache常常不堪负重，苟延残存，任务数常到达300甚至400，后来安装squid2.6接管了大部分的apache，服务器如释重负，不但速度有提升，而且系统负载也低了很多，任务数稳定在100~120之间，任他流量波涛汹涌，服务器依然屹立不倒。</p>
<p>来源:<a href="http://blog.csdn.net/starxu85/archive/2008/11/02/3207586.aspx">http://blog.csdn.net/starxu85/archive/2008/11/02/3207586.aspx</a></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="freebsd7.0 apache php squid 反向代理" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F944&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9876">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4026062.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">freebsd7.0 apache php squid 反向代理</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="squid缓存动态连接" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10591&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9876">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/23/24353543.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">squid缓存动态连接</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="服务器的大用户量的承载方案 Nginx Squid Apache PHP MySQL" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F1349&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9876">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">服务器的大用户量的承载方案 Nginx Squid Apache PHP MySQL</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="apache squid 配置反向代理服务相关文章" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F5895&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9876">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">apache squid 配置反向代理服务相关文章</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.haohtml.com/archives/9876/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache的日志级别和设置</title>
		<link>http://blog.haohtml.com/archives/9695</link>
		<comments>http://blog.haohtml.com/archives/9695#comments</comments>
		<pubDate>Tue, 07 Jun 2011 11:41:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[服务器类]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[日志]]></category>

		<guid isPermaLink="false">http://blog.haohtml.com/?p=9695</guid>
		<description><![CDATA[1.emerg 紧急 - 系统无法使用。 "Child cannot open lock file. Exiting" 2.alert 必须立即采取措施。 "getpwuid: couldn’t determine user name from uid" 3.crit 致命情况。 "socket: Failed to get a socket, exiting child" 4.error 错误情况。 "Premature end of script headers" 5.warn 警告情况。 "child process 1234 did not exit, sending another SIGHUP" 6.notice 一般重要情况。 "httpd: caught SIGBUS, attempting to dump [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="安装awstats来分析apache的访问日志" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F675&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9695">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4023171.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">安装awstats来分析apache的访问日志</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="查看Apache并发请求数及其TCP连接状态[原创]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F3191&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9695">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4024969.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">查看Apache并发请求数及其TCP连接状态[原创]</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache下实现隐藏服务器名称" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10761&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9695">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/31/20204251.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache下实现隐藏服务器名称</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="统计apache日志中每日访问IP中访问量最多的100个IP" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10383&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9695">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">统计apache日志中每日访问IP中访问量最多的100个IP</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<div><strong>1.emerg </strong><br />
紧急 - 系统无法使用。<br />
"Child cannot open lock file. Exiting"</div>
<div><strong>2.alert </strong><br />
必须立即采取措施。<br />
"getpwuid: couldn’t determine user name from uid"</div>
<div><strong>3.crit </strong><br />
致命情况。<br />
"socket: Failed to get a socket, exiting child"</div>
<div><strong>4.error </strong><br />
错误情况。<br />
"Premature end of script headers"</div>
<div><strong> 5.warn </strong><br />
警告情况。<br />
"child process 1234 did not exit, sending another SIGHUP"</div>
<div><strong> 6.notice </strong><br />
一般重要情况。<br />
"httpd: caught SIGBUS, attempting to dump core in ..."</div>
<div><strong>7.info </strong><br />
普通信息。<br />
"Server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers)..."</div>
<div><strong> 8.debug </strong><br />
出错级别信息<br />
"Opening config file ..."<br />
当指定了特定级别时，任何级别高于他的信息也会同时报告。比如说，当指定了LogLevel info时，任何 notice和warn级别的信息也会被记录。<br />
建议至少要使用crit级别。</div>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="安装awstats来分析apache的访问日志" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F675&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9695">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4023171.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">安装awstats来分析apache的访问日志</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="查看Apache并发请求数及其TCP连接状态[原创]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F3191&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9695">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4024969.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">查看Apache并发请求数及其TCP连接状态[原创]</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache下实现隐藏服务器名称" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10761&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9695">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/07/31/20204251.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache下实现隐藏服务器名称</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="统计apache日志中每日访问IP中访问量最多的100个IP" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F10383&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9695">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">统计apache日志中每日访问IP中访问量最多的100个IP</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.haohtml.com/archives/9695/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决Apache出现的CPU高占用率的问题</title>
		<link>http://blog.haohtml.com/archives/9687</link>
		<comments>http://blog.haohtml.com/archives/9687#comments</comments>
		<pubDate>Tue, 07 Jun 2011 01:17:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[服务器类]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cpu]]></category>

		<guid isPermaLink="false">http://blog.haohtml.com/?p=9687</guid>
		<description><![CDATA[所谓Apache出现CPU高占用率就是指Apache在一段时间内持续占用很高的CPU使用率，甚至达到CPU100％，这个时候造成网站无法访问。解决的方法就是仔细观察Apache的日志文件，查阅错误的信息。 我个人试了一下启用了 EnableSendfile Off 暂时解决了， 下面我们针对几种错误信息进行分析并给出解决的方法： 1. Apache与WinSock v2相冲突 Apache官方提供的手册中提到，在Windows系统下Apache2.x为了提高性能而使用了Microsoft WinSock v2 API，但是一些常见的防火墙软件会破坏他的正确性，从而使得Apache出现死循环操作造成CPU100％。 其错误提示如下所示： [error] (730038)An operation was attempted on something that is not a socket.: winnt_accept: AcceptEx failed. Attempting to recover. [error] (OS 10038) : Child 3356: Encountered too many errors accepting client connections. Possible causes: dynamic address renewal, or incompatible VPN or firewall [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="怎么检查windows下apache加载的mpm模块是什么？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F7363&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9687">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4022697.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">怎么检查windows下apache加载的mpm模块是什么？</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="查看Apache并发请求数及其TCP连接状态[原创]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F3191&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9687">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4024969.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">查看Apache并发请求数及其TCP连接状态[原创]</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache 的信息查看模块——Server-Status" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F1415&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9687">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4026369.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache 的信息查看模块——Server-Status</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache内存优化" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F872&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9687">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache内存优化</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>所谓Apache出现CPU高占用率就是指Apache在一段时间内持续占用很高的CPU使用率，甚至达到CPU100％，这个时候造成网站无法访问。解决的方法就是仔细观察Apache的日志文件，查阅错误的信息。</p>
<p>我个人试了一下启用了</p>
<blockquote><p><span style="color: #0000ff;">EnableSendfile Off</span></p></blockquote>
<p>暂时解决了，</p>
<p>下面我们针对几种错误信息进行分析并给出解决的方法：</p>
<p><strong>1. Apache与WinSock v2相冲突</strong><br />
<a href="http://httpd.apache.org/docs/2.0/mod/mpm_winnt.html" target="_blank">Apache官方提供的手册</a>中提到，在Windows系统下Apache2.x为了提高性能而使用了Microsoft WinSock v2 API，但是一些常见的防火墙软件会破坏他的正确性，从而使得Apache出现死循环操作造成CPU100％。</p>
<p>其错误提示如下所示：</p>
<blockquote><p>[error] (730038)An operation was attempted on something that is not a socket.: winnt_accept: AcceptEx failed. Attempting to recover.</p>
<p>[error] (OS 10038) : Child 3356: Encountered too many errors accepting client connections. Possible causes: dynamic address renewal, or incompatible VPN or firewall software. Try using the Win32DisableAcceptEx directive.</p>
<p>[warn] (OS 121)信号灯超时时间已到。 : winnt_accept: Asynchronous AcceptEx failed.</p>
<p>[warn] (OS 64)指定的网络名不再可用。 : winnt_accept: Asynchronous AcceptEx failed.</p></blockquote>
<p>可以依次采用下面的方法来解决上面的问题，如果进行了一步还有问题就继续下一步：<span id="more-9687"></span></p>
<p>1) 在httpd.conf文件中使用 Win32DisableAcceptEx 禁止Apache使用 Microsoft WinSock v2 API ：</p>
<div>
<ol title="Double click to hide line number.">
<li>&lt;IfModule mpm_winnt.c&gt;</li>
<li>Win32DisableAcceptEx # 禁止使用AcceptEx()</li>
<li>&lt;/IfModule&gt;</li>
</ol>
</div>
<p>2) 使用<a href="http://www.kztechs.com/sreng/download.html" target="_blank">System Repair Engineer(SREng)</a>查看WinSocket供应者，如果出现非MS的陌生项则将其删除，并使用软件的“重置WinSocket”按钮进行重置。</p>
<p>3) 卸载与Apache相冲突的杀毒软件或防火墙软件。</p>
<p>如果进行上面的三个步骤之后还有问题，那应该看看是不是还有下面的错误。</p>
<p><strong>2. “Terminating 1 threads that failed to exit”错误</strong><br />
上面错误中的数字1有可能是其他数字，造成这个错误的原因是Apache在退出并发线程的时候出现线程溢出，从而造成内存泄露，表现出来的就是Apache所占用的系统资源持续增长。</p>
<p>解决的方法也很简单，将最大请求线程的值降低一些，但是也不能太低，太低的话会产生大量的请求队列从而造成站点访问缓慢。如果之前为0则将其设置为一个最大值。</p>
<div>
<ol title="Double click to hide line number.">
<li>MaxRequestsPerChild 10000</li>
</ol>
</div>
<p><strong>3. “file .\\server\\mpm\\winnt\\child.c, line 1078, assertion “(rv &gt;= 0) &amp;&amp; (rv &lt; threads_created)” failed” 错误</strong></p>
<p>这个错误是Apache的一个<a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=11997" target="_blank">bug(#11997)</a>，可以通过 Win32DisableAcceptEx 禁止Apache使用WinSocket v2来避免此bug，具体设置见前述。</p>
<p><strong>4. PHP5.2.1以上版本的libmysql.dll与MySQL5不兼容</strong><br />
PHP5.2.1以后的新版本(截止目前最新版本为5.2.5)中用于连接MySQL的libmysql.dll组件与MySQL5不兼容，在Apache中运行PHP的时候会造成Apache产生CPU100%的问题。</p>
<p>解决的方法就是从<a href="http://www.php.net/releases/" target="_blank">http://www.php.net/releases/</a>下载5.2.1版本，将压缩包中的libmysql.dll文件覆盖现在的文件，然后重启Apache就可以了。</p>
<p><strong>5. 病毒或木马程序命名为Apache.exe</strong><br />
有的时候病毒或木马程序会将其名称命名为Apache.exe文件达到一种掩饰的目的，这个时候使用第三方进程分析器查看进程的路径然后将其删除或使用杀毒软件清除就可以了。</p>
<p><strong>6. 程序编写不严谨造成死循环等错误</strong><br />
如果上面的问题都不存在Apache依然产生CPU100%的问题的话，通常来说就应该是Web程序自身的问题了，例如死循环等等。这个时候需要在日志中设置HTTP请求的文件及执行的时间，然后查找出执行时间比较长的地址进行分析排查。</p>
<p>日志格式设置如下：</p>
<blockquote><p>LogFormat “%v %h %l %u %t [%Ts] \”%r\” %&gt;s %b” vhost_common #设置程序执行时间</p>
<p>&lt;VirtualHost xxx.xxx.xx.xx:80&gt;<br />
ServerName xxx.xxx.com<br />
DirectoryIndex index.php index.html index.htm<br />
DocumentRoot “xxx”<br />
# cronolog.exe是Apache自带的用于将日志文件进行分割的应用程序<br />
CustomLog “|bin/cronolog.exe e:/%Y%m%d.log” vhost_common<br />
&lt;/VirtualHost&gt;</p></blockquote>
<p>参考资料：<br />
<a href="http://groups.google.com/group/eachgain/browse_thread/thread/203204184f99e544/339ae75ba239e064%23339ae75ba239e064" target="_blank">apache 遇到[error] (OS 10038) 错误</a><br />
<a href="https://support.kayako.com/index.php?_m=knowledgebase&amp;_a=viewarticle&amp;kbarticleid=236" target="_blank">Error in my_thread_global_end(): 1 threads didn’t exit</a><br />
<a href="http://blog.s135.com/read.php/269.htm?page=1" target="_blank">查看Apache并发请求数及其TCP连接状态</a><br />
<a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=11997" target="_blank">Apache Bug 11997</a><br />
<a href="http://zhumeng99.cn/read.php?48" target="_blank">关于apache.exe开机占用cpu100%的终极解决方法</a><br />
<a href="http://riddle.bokee.com/6200980.html" target="_blank">apache cpu占用100%的问题。</a><br />
<a href="http://x.discuz.net/viewthread-609579.html" target="_blank">空间持续CPU100%时间过长，如何优化程序</a></p>
<p>&nbsp;</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="怎么检查windows下apache加载的mpm模块是什么？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F7363&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9687">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4022697.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">怎么检查windows下apache加载的mpm模块是什么？</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="查看Apache并发请求数及其TCP连接状态[原创]" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F3191&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9687">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4024969.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">查看Apache并发请求数及其TCP连接状态[原创]</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache 的信息查看模块——Server-Status" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F1415&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9687">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4026369.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache 的信息查看模块——Server-Status</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache内存优化" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F872&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9687">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache内存优化</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.haohtml.com/archives/9687/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache防盗链技术实现攻略</title>
		<link>http://blog.haohtml.com/archives/9641</link>
		<comments>http://blog.haohtml.com/archives/9641#comments</comments>
		<pubDate>Fri, 03 Jun 2011 01:37:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[服务器类]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[防盗链]]></category>

		<guid isPermaLink="false">http://blog.haohtml.com/?p=9641</guid>
		<description><![CDATA[国内网站盗链成风，最倒霉的就是咱们这种使用付费主机有流量限制的个人了。没办法，只得加上了一个简单的反盗链(Anti-Leech)措施。我的服务器是 Apache，处理防盗链比较简单，解决之后，于是写下这篇笔记。 一、 使用 rewrite 技术实现 Apache 防盗链 Apache 防盗链的第一种实现方法，可以用 rewrite 实现。首先要确认 Apache 的 rewrite module 可用：能够控制 Apache httpd.conf 文件的，打开 httpd.conf，确保有这么一行配置: LoadModule rewrite_module modules/mod_rewrite.so 然后在找到自己网站对应的 配置的地方，加入下列代码： ServerName haohtml.com # 防盗链配置 RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://haohtml.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://haohtml.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.haohtml.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.haohtml.com$ [NC] RewriteRule .*\.(gif&#124;jpg&#124;swf)$ http://www.haohtml.com/about/nolink.png [R,NC] 防盗链配置的说明： 1. 红色部分: [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Apache实现图片防盗链" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F687&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9641">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache实现图片防盗链</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache图片防盗链" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9422&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9641">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache图片防盗链</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="APACHE优化之apache的内存使用" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F868&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9641">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">APACHE优化之apache的内存使用</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache内存优化" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F872&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9641">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache内存优化</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>国内网站盗链成风，最倒霉的就是咱们这种使用付费主机有流量限制的个人了。没办法，只得加上了一个简单的反盗链(Anti-Leech)措施。我的服务器是 Apache，处理防盗链比较简单，解决之后，于是写下这篇笔记。</p>
<p><strong>一、 使用 rewrite 技术实现 Apache 防盗链 </strong></p>
<p>Apache 防盗链的第一种实现方法，可以用 rewrite 实现。首先要确认 Apache 的 rewrite module 可用：能够控制 Apache httpd.conf 文件的，打开 httpd.conf，确保有这么一行配置:</p>
<blockquote><p>LoadModule rewrite_module modules/mod_rewrite.so</p></blockquote>
<p>然后在找到自己网站对应的 配置的地方，加入下列代码：</p>
<blockquote><p>ServerName haohtml.com</p>
<p># 防盗链配置<br />
RewriteEngine On<br />
RewriteCond %{HTTP_REFERER} !^http:<span style="color: #008000;">//</span><span style="color: #ff0000;">haohtml.com/</span><span style="color: #008000;">.*$ [NC]</span><br />
RewriteCond %{HTTP_REFERER} !^http:<span style="color: #008000;">//</span><span style="color: #ff0000;">haohtml.com</span><span style="color: #008000;">$ [NC]</span><br />
RewriteCond %{HTTP_REFERER} !^http:<span style="color: #008000;">//</span><span style="color: #ff0000;">www.haohtml.com</span><span style="color: #008000;">/.*$ [NC]</span><br />
RewriteCond %{HTTP_REFERER} !^http:<span style="color: #008000;">//</span><span style="color: #ff0000;">www.haohtml.com</span><span style="color: #008000;">$ [NC]</span><br />
RewriteRule .*\.(<span style="color: #00ff00;">gif</span>|<span style="color: #00ff00;">jpg</span>|<span style="color: #00ff00;">swf</span>)$ <span style="color: #0000ff;">http://www.haohtml.com/about/nolink.png</span> <span style="color: #008000;">[R,NC]</span></p></blockquote>
<p><span style="color: #0000ff;">防盗链配置的说明：</span></p>
<p>1. <span style="color: #ff0000;">红色部分: </span>表示自己的信任站点。对我的站点来说，设置为 http://www.haohtml.com 和 http://haohtml.com<span id="more-9641"></span><br />
2. <span style="color: #99cc00;">绿色部分:</span> 要保护文件的扩展名(以|分开)。以这些为扩展名的文件，必须通过红色标注的网址引用，才可以访问。<br />
3. <span style="color: #0000ff;">蓝色部分: </span>盗链后的重定向页面。用以输出警示信息，这张图片应该尽可能的小。例如我的警示图片是 http://www.haohtml.com/about/nolink.png。为了简单处理的原因，我的绿色字体部分，要保护的图片扩展中，没有 .png 的图片，而警示图片是 .png的。（我站内没有 .png的其他图片）</p>
<p>然后重新启动 apache 服务器即可。</p>
<p>有些用户使用的是虚拟主机，没有服务器的控制权，无法修改 httpd.conf 文件和重启服务器。那么请确认你的虚拟主机支持 .htaccess，将上面的配置写入 .htaccess 文件，放入根目录或图片所在的目录即可：</p>
<p>htaccess 文件的内容：</p>
<blockquote><p># 防盗链配置<br />
RewriteEngine On<br />
RewriteCond %{HTTP_REFERER} !^http:<span style="color: #008000;">//<span style="color: #ff0000;">haohtml.com/</span>.*$ [NC]</span><br />
RewriteCond %{HTTP_REFERER} !^http:<span style="color: #008000;">//<span style="color: #ff0000;">haohtml.com</span>$ [NC]</span><br />
RewriteCond %{HTTP_REFERER} !^http:<span style="color: #008000;">//<span style="color: #ff0000;">www.haohtml.com</span>/.*$ [NC]</span><br />
RewriteCond %{HTTP_REFERER} !^http:<span style="color: #008000;">//<span style="color: #ff0000;">www.haohtml.com</span>$ [NC]</span><br />
RewriteRule .*\.(<span style="color: #99cc00;">gif</span>|<span style="color: #99cc00;">jpg</span>|<span style="color: #99cc00;">swf</span>)$ <span style="color: #0000ff;">http://www.haohtml.com/about/nolink.png</span> <span style="color: #008000;">[R,NC]</span></p></blockquote>
<p>注意:</p>
<p>1. httpd.conf 文件里的配置，是在 apache 启动时一次读取，效率很高<br />
2. .htaccess 文件里的配置，每次访问都需要读取分析，效率很低。</p>
<p><strong>二、 使用 SetEnvIfNoCase 和 access 技术实现 Apache 防盗链 </strong></p>
<p>另一种方式是利用 SetEnvIfNoCase 和 access。具体的代码如下：</p>
<blockquote><p>SetEnvIfNoCase Referer "^http://haohtml.com" local_ref=1<br />
SetEnvIfNoCase Referer "^http://www.haohtml.com" local_ref=1</p>
<p>Order Allow,Deny<br />
Allow from env=local_ref</p></blockquote>
<p>将上述代码，放入前面所讲的 httpd.conf 或 .htaccess 文件即可。</p>
<p><strong>三、Apache 防盗链技术小结</strong></p>
<p>通过判断 referer 变量的值，判断图片或资源的引用是否合法，只有在设定范围内的 referer，才能访问指定的资源，从而实现了防盗链(Anti-Leech)的目的。需要指出的是：不是所有的用户代理（浏览器）都会设置 referer 变量，而且有的还可以手工修改 referer，也就是说，referer 是可以被伪造的。本文所讲的，只是一种简单的防护手段。当然，应付一般的盗链也足够了。</p>
<p><strong>四、参考资料</strong></p>
<p>Apache Documentation: Authentication, Authorization and Access Control (v2.2)<br />
Apache Documentation: htaccess files (V2.2)<br />
来源：<a href="http://server.it168.com/server/2008-01-11/200801100802859_1.shtml" target="_blank">http://server.it168.com/server/2008-01-11/200801100802859_1.shtml</a></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Apache实现图片防盗链" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F687&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9641">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache实现图片防盗链</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache图片防盗链" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9422&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9641">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache图片防盗链</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="APACHE优化之apache的内存使用" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F868&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9641">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">APACHE优化之apache的内存使用</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache内存优化" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F872&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9641">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache内存优化</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.haohtml.com/archives/9641/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache图片防盗链</title>
		<link>http://blog.haohtml.com/archives/9422</link>
		<comments>http://blog.haohtml.com/archives/9422#comments</comments>
		<pubDate>Wed, 04 May 2011 08:42:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[服务器类]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://blog.haohtml.com/?p=9422</guid>
		<description><![CDATA[最近发现论坛的流量大涨，查后发现很多地方在调用论坛的图片，造成无用的流量，加大了服务器的负载，决定给CU论坛加上了防盗链图片功能 SetEnvIfNoCase Referer "chinaunix.net" local_ref=1 Order Allow,Deny Allow from env=local_ref 外部网站调用论坛的图片会跳转到另一张图： ErrorDocument 403 http://www.chinaunix.net/error.gif 下边转贴一篇老外写的文章，有时间再翻译 Preventing Image 'Theft' By: Ken Coar Copyright © 2000 by Ken Coar. All rights reserved. Limited rights granted to Internet.Com. Keeping Your Images from Adorning Other Sites Webmasters are ever searching for ways to make their sites look cool and [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="apache内存报死" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F878&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9422">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">apache内存报死</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="apache你必须知道的一些知识" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F4663&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9422">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">apache你必须知道的一些知识</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="apache工作方式" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F4656&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9422">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">apache工作方式</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="怎么检查windows下apache加载的mpm模块是什么？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F7363&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9422">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4022697.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">怎么检查windows下apache加载的mpm模块是什么？</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>最近发现论坛的流量大涨，查后发现很多地方在调用论坛的图片，造成无用的流量，加大了服务器的负载，决定给CU论坛加上了防盗链图片功能</p>
<p>SetEnvIfNoCase Referer "chinaunix.net" local_ref=1</p>
<p>Order Allow,Deny<br />
Allow from env=local_ref</p>
<p>外部网站调用论坛的图片会跳转到另一张图：<br />
ErrorDocument 403 http://www.chinaunix.net/error.gif</p>
<p>下边转贴一篇老外写的文章，有时间再翻译</p>
<p>Preventing Image 'Theft'<span id="more-9422"></span></p>
<p>By: Ken Coar<br />
Copyright © 2000 by Ken Coar. All rights reserved. Limited rights granted to Internet.Com.<br />
Keeping Your Images from Adorning Other Sites</p>
<p>Webmasters are ever searching for ways to make their sites look cool and attractive. One way is to dress it up with images, logos, and other graphics -- sometimes referred to as 'eye candy.' Of course, if you happen to be in the forefront of this in any way, you run the risk of having others cadge your art in order to dress up their sites. And they probably won't even ask permission nor pay you a royalty, either.</p>
<p>This article shows how you can use Apache configuration directives to limit access to your art so that it's more difficult to use elsewhere.<br />
The Problem</p>
<p>Simply put, there are two types of 'infringement' involved here:</p>
<p>Someone uses an IMG tag on its site to refer to a graphic on yours<br />
Someone downloads an image from your site and makes a copy on its</p>
<p>The first type not only causes your images to prettify someone else's site, but hurts you more directly because visitors to their site are hammering yours to get the images. Your log files get filled with access request entries, your bandwidth gets used -- and you're getting no benefit from it. This type of theft is almost completely preventable.</p>
<p>The second type of theft is more insidious. The 'borrower' doesn't cause your site to get pounded on for access to the images, since they've been copied to the borrower's site, but you probably weren't given any credit for the artwork -- and you probably don't even know the theft happened. Because of the way the Web works, this type of theft can't really be prevented, but you can at least make it a little more difficult.</p>
<p>You can't completely prevent either of these, of course, but you can make them more difficult to do.<br />
Identifying the Files to Protect</p>
<p>You're probably not going to want to protect every document on your site. Even if you do, for the sake of this article I'm assuming you only want to protect your artwork. So how do you indicate that the rules only apply to them? With directives such as the following in your server config files:<br />
[limiting directives will go here]</p>
<p>You can put a container such as this inside a  container, or inside a  container, or outside any containers at all (in which case it applies to all such files on your server), or even inside .htaccess files. Put it wherever it makes sense to protect what you want protected.<br />
The Key: the Referer Header Field</p>
<p>Down on the wire, where the browsers, spiders, and servers live, every request for a Web page includes a component called the HTTP request header. This contains information about the request, such as the user's preferred languages, the types of documents the client is able to handle -- and not least, the name of the item being requested. This information is conveyed in a series of name/value pairs called header fields.</p>
<p>One of these header fields is of particular importance to what we want to do. It's called the Referer field (yes, I know, it's misspelt -- but that's how it's misspelt in the definition, too), and it indicates the URL of the client's last page if and only if the client is following a link. That is, if you're viewing page A, and click on a link to page B, the request for page B will include a Referer field that says "I'm following a link on page A." If no link is being followed, such as if the user just typed B's URL into the Location field of his browser, there will be no Referer field in the request header.</p>
<p>How does this help? Well, it gives us a way to tell whether an image is being requested because it was linked to by one of our pages -- or by someone else's.<br />
Using SetEnvIf to 'Tag' Images</p>
<p>For a simple case, suppose our Web site's main page is . In this case, we want to restrict any artwork requests that don't originate on our site (i.e., only allow them if the image was linked to by one of our pages). We can do this by using an environment variable (also called an envariable) as a flag, and setting it if the conditions are right. Something like the following ought to do it:</p>
<p>SetEnvIfNoCase Referer "^http://my\.apache\.org/" local_ref=1</p>
<p>When Apache processes a request, it will examine the Referer field in the header, and set the environment variable local_ref to "1" if the value starts with our site address -- i.e., is one of our pages.</p>
<p>The string inside the quotation marks is a regular expression pattern that the value must match in order for the environment variable to be set. Describing how to use regular expressions (REs) is far beyond the scope of this article; for now, just be aware that the SetEnvIf* directives use them.</p>
<p>The "NoCase" portion of the directive name means, "do this whether the Referer is 'http://my.apache.org/', or 'http://My.Apache.Org/', or 'http://MY.APACHE.ORG/' -- in other words, ignore the upper/lower caseness of the value.<br />
Using Envariables in Access Control</p>
<p>The Order, Allow, and Deny directives allow us to control access to documents based upon the setting (or unset-ness) of an envariable. The first thing to do is to indicate the order in which Apache will process Allow and Deny directives; you do with the Order directive as follows:</p>
<p>Order Allow,Deny</p>
<p>This means that Apache will go through any list of Allow directives it has that apply to the current request, and then repeat the process with any Deny directives. With this ordering, the default condition is 'denied;' that is, no-one will be able to access anything unless there's an applicable Allow directive.</p>
<p>All right, so let's add the directive that will let local references work:</p>
<p>Order Allow,Deny<br />
Allow from env=local_ref</p>
<p>This will let a request proceed if the local_ref envariable is set (with any value whatsoever). Any and all other requests will be denied because they don't meet the Allow conditions and the default is to deny access.</p>
<p>Note:<br />
Please don't fall into the trap of sprinkling your .htaccess and server config files with  containers. You almost certainly don't need them, and they'll just confuse the issue. Don't use them unless you really want to have GET requests treated differently from POST requests, for instance.</p>
<p>Putting It All Together</p>
<p>Putting all these pieces together, we end up with a stanza of directives that looks something like this:</p>
<p>SetEnvIfNoCase Referer "^http://my\.apache\.org/" local_ref=1</p>
<p>Order Allow,Deny<br />
Allow from env=local_ref</p>
<p>These may all appear in your server-wide configuration files (e.g., httpd.conf), or you can put the  container in one or more .htaccess files. The effect is the same: Within the scope of these directives, images can only be fetched if they were linked to from one of your pages.</p>
<p>Note:<br />
As of Apache 1.3.12 and earlier, the SetEnvIf* directives are only allowed in the server-wide configuration files. In later versions, they can be used inside containers and in .htaccess files.</p>
<p>Going Further</p>
<p>I mentioned earlier that you can't fully prevent image theft. That's because of two things, which apply pretty much to the two different types of poaching respectively:</p>
<p>Someone who really wants your artwork can always request it using a faked-up Referer value that happens to meet your criteria. In other words, by jiggering up the request so it looks like it's a reference from your site.<br />
If someone legitimately views your artwork by going through your pages, the image files are almost certainly in his client's cache somewhere. So he can pull it out of a cached valid request rather than making another one just to pick up the image.</p>
<p>Though it's essentially impossible to foil someone who's really desperate to snitch your artwork, the steps described in this article should make it too difficult for the casual poacher.</p>
<p>Another thing you can do, depending upon how protective you are of your art, is to watermark the images. Watermarking a digital image consists of encoding a special 'signature' into the graphic so that it can be detected later. Digital watermarking doesn't degrade the quality of the image, and can be done in such a way that even a cropped subsection of the image contains the mark, and it's detectable even if the image has been otherwise edited since the mark was inserted. It's even possible to detect a watermark in an image that was printed and then scanned in, having left the digital realm altogether! If you watermark your images, there's an excellent chance you'll be able to prove snitching if you ever find a suspicious image on another site somewhere.<br />
Logging Snitch-Attempt Requests</p>
<p>If you're not sure whether anyone is really after your artwork, you can use the same detection mechanism and envariable to log suspicious requests. For instance, if you add the following directives to your httpd.conf file, an entry will be made in the /usr/local/web/apache/logs/poachers_log file any time someone accesses one of your images without a valid Referer:</p>
<p>SetEnvIfNoCase Referer      "!^http://my\.apache\.org/" not_local_ref=1<br />
SetEnvIfNoCase Request_URI  "\.(gif|jpg)"               is_image=1<br />
RewriteEngine  On<br />
RewriteCond    ${ENV:not_local_ref} =1<br />
RewriteCond    ${ENV:is_image}      =1<br />
RewriteRule    .*                   -     [Last,Env=poach_attempt:1]<br />
CustomLog logs/poachers_log         CLF   env=poach_attempt</p>
<p>This should have the effect of logging all attempts to access your images using one of the potential 'snitching' techniques described in this article. The first two lines set flags for the conditions (that it's an image, and that it wasn't referred by a local document), the RewriteCond lines check to see if the flags are set, the RewriteRule line sets a third flag combining the two, and the last line causes the logging of the request in a special file if that last flag is set. The log entry is written in the pre-defined 'CLF' format ('Common Log Format'), but you could put together your own format just as easily.<br />
Other Resources</p>
<p>The techniques described in this article are geared toward a single purpose, but illustrate some of the capabilities of the Apache server. Here are some pointers to resources for further investigation:</p>
<p>The HTTP/1.1 definition document:<br />
The main Apache Web site, of course:<br />
The documentation for Apache and its modules:<br />
The canonical email response page:<br />
(This page is normally used to respond to email requests for support, but there are lots of good resources listed on it.)</p>
<p>Then there are the specific pieces of the Apache documentation that are directly related to the directives and commands described in this article:</p>
<p>The documentation for  documentation:<br />
The mod_setenvif documentation:<br />
The mod_access documentation:<br />
The mod_rewrite documentation:<br />
The documentation on the CustomLog directive:</p>
<p>Conclusion</p>
<p>Custom artwork can result from someone's effort, and taking without permission something that another has created is generally accepted as theft. This article has described a basic way to put your works of art behind a velvet rope -- if you're so inclined. It won't stop determined thieves, but it should hopefully stymy or dissuade the more casual ones.<br />
Got a Topic You Want Covered?</p>
<p>If you have a particular Apache-related topic that you'd like covered in a future article in this column, please let me know; drop me an email at . I do read and answer my email, usually within a few hours (although a few days may pass if I'm travelling or my mail volume is 'way up). If I don't respond within what seems to be a reasonable amount of time, feel free to ping me again.<br />
About the Author</p>
<p>Ken Coar is a member of the Apache Group and a director and vice president of the Apache Software Foundation. He is also a core member of the Jikes open-source Java compiler project, a contributor to the PHP project, the author of Apache Server for Dummies, and a contributing author to Apache Server Unleashed. He can be reached via email at .</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="apache内存报死" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F878&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9422">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">apache内存报死</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="apache你必须知道的一些知识" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F4663&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9422">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">apache你必须知道的一些知识</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="apache工作方式" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F4656&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9422">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">apache工作方式</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="怎么检查windows下apache加载的mpm模块是什么？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F7363&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F9422">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4022697.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">怎么检查windows下apache加载的mpm模块是什么？</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.haohtml.com/archives/9422/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在windows下玩apache-php不能不知的几个小设置</title>
		<link>http://blog.haohtml.com/archives/8802</link>
		<comments>http://blog.haohtml.com/archives/8802#comments</comments>
		<pubDate>Thu, 31 Mar 2011 12:50:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[服务器类]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.haohtml.com/?p=8802</guid>
		<description><![CDATA[1、PHPIniDir “D:\PHP5″ 这样不用每次都把php.ini拷贝到C:\Windows下 2、set Path=D:\PHP5;D:\PHP5\ext;%Path% 这样不用每次把那些dll拷贝到C:\Windows\system32下 &#160;<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="windows下apache+php平台，虚拟主机安全设置" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F3440&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F8802">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">windows下apache+php平台，虚拟主机安全设置</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="[精典教程]freebsd下安装mysql,apache,php,phpmyadmin记录" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F435&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F8802">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4022261.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">[精典教程]freebsd下安装mysql,apache,php,phpmyadmin记录</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="apache 中控制虚拟主机的php功能" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F530&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F8802">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">apache 中控制虚拟主机的php功能</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache+php+mysql在windows下安装与简单配置" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F2784&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F8802">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache+php+mysql在windows下安装与简单配置</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>1、PHPIniDir “D:\PHP5″</p>
<p>这样不用每次都把php.ini拷贝到C:\Windows下</p>
<p>2、set Path=D:\PHP5;D:\PHP5\ext;%Path%</p>
<p>这样不用每次把那些dll拷贝到C:\Windows\system32下</p>
<p>&nbsp;</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="windows下apache+php平台，虚拟主机安全设置" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F3440&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F8802">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">windows下apache+php平台，虚拟主机安全设置</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="[精典教程]freebsd下安装mysql,apache,php,phpmyadmin记录" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F435&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F8802">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/03/22/4022261.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">[精典教程]freebsd下安装mysql,apache,php,phpmyadmin记录</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="apache 中控制虚拟主机的php功能" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F530&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F8802">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">apache 中控制虚拟主机的php功能</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Apache+php+mysql在windows下安装与简单配置" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F2784&from=http%3A%2F%2Fblog.haohtml.com%2Farchives%2F8802">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Apache+php+mysql在windows下安装与简单配置</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.haohtml.com/archives/8802/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

