<?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>Security Team Blog &#187; Unix日志</title>
	<atom:link href="http://www.secblog.cn/category/unix/feed" rel="self" type="application/rss+xml" />
	<link>http://www.secblog.cn</link>
	<description>服务器系统架构、优化及网络安全</description>
	<lastBuildDate>Tue, 29 Nov 2011 02:15:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>完美解决Nginx的跨站（防WEBshell）的问题 转载</title>
		<link>http://www.secblog.cn/unix/975.html</link>
		<comments>http://www.secblog.cn/unix/975.html#comments</comments>
		<pubDate>Tue, 29 Nov 2011 02:15:12 +0000</pubDate>
		<dc:creator>豬頭濱</dc:creator>
				<category><![CDATA[Unix日志]]></category>

		<guid isPermaLink="false">http://www.secblog.cn/?p=975</guid>
		<description><![CDATA[看了很多方法，试了一下这个最好用，需要更改php源程序后，重新编译php。在使用fpm方式安装时，打补丁过程中会修改php的文件，所以需要在打完fpm补丁后再修改php源程序。 tar zxvf php-5.2.14.tar.gz gzip -cd php-5.2.14-fpm-0.5.14.diff.gz &#124; patch -d php-5.2.14 -p1 cd php-5.2.14/ vi  main/fopen_wrappers.c /* {{{ php_check_open_basedir */ PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC) { /* Only check when open_basedir is available */ if (PG(open_basedir) &#38;&#38; *PG(open_basedir)) { char *pathbuf; char *ptr; char *end; // 添加的内容开始 char *env_document_root = sapi_getenv(“DOCUMENT_ROOT”, sizeof(“DOCUMENT_ROOT”)-1 TSRMLS_CC); if (php_check_specific_open_basedir(ptr, path TSRMLS_CC) == 0) { efree(env_document_root); return 0; } // 添加的内容结束 pathbuf = estrdup(PG(open_basedir)); ptr = pathbuf; while (ptr &#38;&#38; *ptr) { end = strchr(ptr, DEFAULT_DIR_SEPARATOR); if (end != NULL) { *end = &#8217;\0&#8242;; end++; } if (php_check_specific_open_basedir(ptr, path TSRMLS_CC) == 0) { efree(pathbuf); return 0; } ptr = end; } if (warn) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ”open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s)”, path, PG(open_basedir)); } efree(pathbuf); errno = EPERM; /* we deny permission to open it */ return -1; } /* Nothing to check&#8230; */ return 0; } 需要添加的内容用红色表示出来了，然后重新编译安装php即可。 最后不要忘了将php.ini中的open_basedir改为：open_basedir = ”/var/tmp/:/tmp/” 经亲测可用。 使用phpspy2008测试，无法浏览其他目录。]]></description>
			<content:encoded><![CDATA[<p>看了很多方法，试了一下这个最好用，需要更改php源程序后，重新编译php。在使用fpm方式安装时，打补丁过程中会修改php的文件，所以需要在打完fpm补丁后再修改php源程序。</p>
<p>tar zxvf php-5.2.14.tar.gz<br />
gzip -cd php-5.2.14-fpm-0.5.14.diff.gz | patch -d php-5.2.14 -p1<br />
cd php-5.2.14/</p>
<p>vi  main/fopen_wrappers.c</p>
<p>/* {{{ php_check_open_basedir<br />
*/<br />
PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC)<br />
{<br />
/* Only check when open_basedir is available */<br />
if (PG(open_basedir) &amp;&amp; *PG(open_basedir)) {<br />
char *pathbuf;<br />
char *ptr;<br />
char *end;</p>
<p>// 添加的内容开始<br />
char *env_document_root = sapi_getenv(“DOCUMENT_ROOT”, sizeof(“DOCUMENT_ROOT”)-1 TSRMLS_CC);<br />
if (php_check_specific_open_basedir(ptr, path TSRMLS_CC) == 0) {<br />
efree(env_document_root);<br />
return 0;<br />
}<br />
// 添加的内容结束</p>
<p>pathbuf = estrdup(PG(open_basedir));</p>
<p>ptr = pathbuf;</p>
<p>while (ptr &amp;&amp; *ptr) {<br />
end = strchr(ptr, DEFAULT_DIR_SEPARATOR);<br />
if (end != NULL) {<br />
*end = &#8217;\0&#8242;;<br />
end++;<br />
}</p>
<p>if (php_check_specific_open_basedir(ptr, path TSRMLS_CC) == 0) {<br />
efree(pathbuf);<br />
return 0;<br />
}</p>
<p>ptr = end;<br />
}<br />
if (warn) {<br />
php_error_docref(NULL TSRMLS_CC, E_WARNING, ”open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s)”, path, PG(open_basedir));<br />
}<br />
efree(pathbuf);<br />
errno = EPERM; /* we deny permission to open it */<br />
return -1;<br />
}</p>
<p>/* Nothing to check&#8230; */<br />
return 0;<br />
}</p>
<p>需要添加的内容用红色表示出来了，然后重新编译安装php即可。<br />
最后不要忘了将php.ini中的open_basedir改为：open_basedir = ”/var/tmp/:/tmp/”</p>
<p>经亲测可用。</p>
<p>使用phpspy2008测试，无法浏览其他目录。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.secblog.cn/unix/975.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>配置 Linux 服务器 SSH 安全访问的四个小技巧</title>
		<link>http://www.secblog.cn/unix/912.html</link>
		<comments>http://www.secblog.cn/unix/912.html#comments</comments>
		<pubDate>Fri, 25 Mar 2011 12:10:34 +0000</pubDate>
		<dc:creator>豬頭濱</dc:creator>
				<category><![CDATA[Unix日志]]></category>

		<guid isPermaLink="false">http://www.secblog.cn/?p=912</guid>
		<description><![CDATA[Linux SSH 安全策略一：更改 SSH 端口 默认的 SSH 端口是 22。强烈建议改成 10000 以上。这样别人扫描到端口的机率也大大下降。修改方法： # 编辑 /etc/ssh/ssh_config vi /etc/ssh/ssh_config # 在 Host * 下 ，加入新的 Port 值。以 22000 为例（下同）： Port 22 Port 22000 # 编辑 /etc/ssh/sshd_config vi /etc/ssh/sshd_config #加入新的 Port 值 Port 22 Port 22000 # 保存后，重启 SSH 服务： service sshd restart 　　这里我设置了两个端口，主要是为了防止修改出错导致 SSH 再也登不上。更改你的 SSH 客户端(例如：Putty)的连接端口，测试连接，如果新端口能连接成功，则再编辑上面两个文件，删除 Port [...]]]></description>
			<content:encoded><![CDATA[<h2>Linux SSH 安全策略一：更改 SSH 端口</h2>
<p>默认的 SSH 端口是 22。强烈建议改成 10000 以上。这样别人扫描到端口的机率也大大下降。修改方法：</p>
<pre><tt># 编辑 /etc/ssh/ssh_config
vi /etc/ssh/ssh_config
# 在 Host * 下 ，加入新的 Port 值。以 22000 为例（下同）：
Port 22
Port 22000

# 编辑 /etc/ssh/sshd_config
vi /etc/ssh/sshd_config
#加入新的 Port 值
Port 22
Port 22000

# 保存后，重启 SSH 服务：
service sshd restart

　　这里我设置了两个端口，主要是为了防止修改出错导致 SSH 再也登不上。更改你的 SSH 客户端(例如：<strong>Putty</strong>)的连接端口，测试连接，<strong>如果新端口能连接成功，则再编辑上面两个文件，删除 Port 22 的配置</strong>。如果连接失败，而用 Port 22 连接后再重新配置。

　　端口设置成功后，注意同时应该从 iptables 中， 删除22端口，添加新配置的 22000，并重启 iptables。
</tt></pre>
<pre><tt>
<h2>Linux SSH 安全策略二：限制 IP 登录</h2>

如果你能以固定 IP 方式连接你的服务器，那么，你可以设置只允许某个特定的 IP 登录服务器
<pre><tt># 编辑 /etc/hosts.allow
vi /etc/hosts.allow
# 例如只允许 123.45.67.89 登录
sshd:123.45.67.89</tt></pre>
<h2>Linux SSH 安全策略三：public key认证登录</h2>
<p><a href="http://www.secblog.cn/unix/457.html">http://www.secblog.cn/unix/457.html</a></p>
<h2>Linux SSH 安全策略四：使用DenyHosts</h2>
<p><a href="http://denyhosts.sourceforge.net/">http://denyhosts.sourceforge.net/</a></p>
<p></tt></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.secblog.cn/unix/912.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostFix之postqueue指令</title>
		<link>http://www.secblog.cn/unix/871.html</link>
		<comments>http://www.secblog.cn/unix/871.html#comments</comments>
		<pubDate>Fri, 03 Dec 2010 10:17:29 +0000</pubDate>
		<dc:creator>豬頭濱</dc:creator>
				<category><![CDATA[Unix日志]]></category>

		<guid isPermaLink="false">http://www.secblog.cn/?p=871</guid>
		<description><![CDATA[看被Queue的信: postqueue -q (我都是用這個) or mailq 強迫將Queue信寄出: postqueue -f 刪除所有被Queue的信: postsuper -d ALL 刪除某封Queue的信: 先用postqueue -q or mailq 查queue_id postsuper -d queue_id 刪除所有正在 deferred 佇列中的郵件 ( 刪除曾經發送失敗的信 ): postsuper -d ALL deferred 刪除所有正在 deferred 佇列中的郵件 ( 可看出哪些信被刪除了 ): find /var/spool/postfix/deferred -type f -exec rm -vf {} ; 刪掉「三天以前」無法發出的郵件: find /var/spool/postfix/deferred -type f -mtime +3 -exec [...]]]></description>
			<content:encoded><![CDATA[<p><strong>看被Queue的信:</strong><br />
postqueue  -q (我都是用這個)<br />
or<br />
mailq</p>
<p><strong>強迫將Queue信寄出:<br />
</strong>postqueue  -f</p>
<p><strong>刪除所有被Queue的信:<br />
</strong><strong>postsuper</strong> -<strong>d</strong> <strong>ALL</strong></p>
<p><strong>刪除某封Queue的信:<br />
</strong>先用postqueue -q  or<br />
mailq<br />
查queue_id<br />
<strong>postsuper</strong> -<strong>d</strong> queue_id</p>
<p><strong>刪除所有正在 <a name="baidusnap3"></a><strong>deferred</strong> 佇列中的郵件 ( 刪除曾經發送失敗的信 ):</strong><br />
<strong>postsuper</strong> -<strong>d</strong> <strong>ALL</strong> <strong>deferred</strong></p>
<p><strong>刪除所有正在 <strong>deferred</strong> 佇列中的郵件 ( 可看出哪些信被刪除了  ):</strong><br />
find  /var/spool/postfix/<strong>deferred</strong> -type f -exec rm -vf {}  ;</p>
<p><strong>刪掉「三天以前」無法發出的郵件:</strong><br />
find  /var/spool/postfix/<strong>deferred</strong> -type f -mtime +3 -exec rm -f {}  ;</p>
<p><strong>列出目前所有無法發出的郵件:<br />
</strong>find  /var/spool/postfix/<strong>deferred</strong> -type f -exec ls -l &#8211;time-style=+%Y-%m-%<strong>d</strong>_%H:%M:%S  {} ;</p>
<p><strong>刪除超過 5 天的  “defer” 佇列中的退信紀錄:</strong><br />
find /var/spool/postfix/defer -type f  -mtime +5 -exec rm -f {} ;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.secblog.cn/unix/871.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postfix &amp; Sendmail 指令整理</title>
		<link>http://www.secblog.cn/unix/869.html</link>
		<comments>http://www.secblog.cn/unix/869.html#comments</comments>
		<pubDate>Fri, 03 Dec 2010 10:16:45 +0000</pubDate>
		<dc:creator>豬頭濱</dc:creator>
				<category><![CDATA[Unix日志]]></category>

		<guid isPermaLink="false">http://www.secblog.cn/?p=869</guid>
		<description><![CDATA[錯誤訊息: , relay=local, delay=0.01, delays=0/0/0/0.01, dsn=5.2.2, status=bounced (cannot update mailbox /var/ma il/root for user root. error writing message: File too large) 檢查mailbox_size_limit postconf &#124; grep “mailbox_size_limit” vim /etc/postfix/main.cf , xxxxx是新的mail box size 預設是50MB 加入  mailbox_size_limit = xxxxx postfix reload 查看待寄信件: mailq 看看該待寄信件詳情: postcat /var/spool/postfix/diferred/1/1CF2CE20FD7 刪除該待寄信件: postsuper -d 1CF2CE20FD7 刪除所有queue中信件: postsuper -d ALL 檢查修復postfix信件檔: postsuper -sv [...]]]></description>
			<content:encoded><![CDATA[<p>錯誤訊息:<br />
, relay=local, delay=0.01, delays=0/0/0/0.01, dsn=5.2.2, status=bounced (cannot update mailbox /var/ma<br />
il/root for user root. error writing message: File too large)</p>
<p>檢查mailbox_size_limit<br />
postconf | grep “mailbox_size_limit”</p>
<p>vim /etc/postfix/main.cf , xxxxx是新的mail box size 預設是50MB<br />
加入  mailbox_size_limit = xxxxx<br />
postfix reload</p>
<p>查看待寄信件: mailq<br />
看看該待寄信件詳情: postcat /var/spool/postfix/diferred/1/1CF2CE20FD7<br />
刪除該待寄信件: <a name="baidusnap0"></a><strong>postsuper</strong> -<a name="baidusnap1"></a><strong>d</strong> 1CF2CE20FD7<br />
刪除所有queue中信件: <strong>postsuper</strong> -<strong>d</strong> <a name="baidusnap2"></a><strong>ALL</strong><br />
檢查修復postfix信件檔: <strong>postsuper</strong> -sv<br />
手動寄出mail queue中的信件： postqueue -f</p>
<p><strong>PostFix Mail  Queue相關名稱:<br />
</strong>incoming=寄進來的信。<br />
active=正準備發送的信。<br />
defered=無法傳送的信。會持續重試。<br />
corrupt=無法讀取或毀損的信。<br />
hold=被暫停發送的信。需要手動開啟才會發出。</p>
<p>PostFix  Delivery Status Reports<br />
bounce=每一位收件者的寄送狀態資訊，說明為什　被「退信」。<br />
由 bounce(8)  程式控管<br />
defer=每一位收件者的寄送狀態資訊，說明為什　被「延遲寄信」。<br />
由 defer(8)  程式控管<br />
trace=每一位收件者的寄送狀態資訊，說明被 Postfix 用 “sendmail -v” 或 “sendmail -bv”  指令執行過的狀態。<br />
由 trace(8) 程式控管</p>
]]></content:encoded>
			<wfw:commentRss>http://www.secblog.cn/unix/869.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>postfix中qshape的用法</title>
		<link>http://www.secblog.cn/unix/866.html</link>
		<comments>http://www.secblog.cn/unix/866.html#comments</comments>
		<pubDate>Thu, 02 Dec 2010 08:27:32 +0000</pubDate>
		<dc:creator>豬頭濱</dc:creator>
				<category><![CDATA[Unix日志]]></category>

		<guid isPermaLink="false">http://www.secblog.cn/unix/866.html</guid>
		<description><![CDATA[qshape是显示邮件队列的邮件各域分布情况. 如：qshape -s deferred [root@localhost ~]# qshape -s active&#124;head T   5  10 20 40 80 160 320 640 1280 1280+ TOTAL                    468 335 124  6  1  1   0   0   0    1     0 unixidc.com                  28  20   8  0  0  0   0   0   0    0     0 earthlink.net            13  13   0  0  0  0   0   0   0    0     0 [...]]]></description>
			<content:encoded><![CDATA[<p>qshape是显示邮件队列的邮件各域分布情况.</p>
<p>如：qshape -s deferred</p>
<p>[root@localhost ~]# qshape -s active|head<br />
T   5  10 20 40 80 160 320 640 1280 1280+<br />
TOTAL                    468 335 124  6  1  1   0   0   0    1     0<br />
unixidc.com                  28  20   8  0  0  0   0   0   0    0     0<br />
earthlink.net            13  13   0  0  0  0   0   0   0    0     0<br />
quickmail.51job.com      12  10   2  0  0  0   0   0   0    0     0<br />
smartland.com.hk         10  10   0  0  0  0   0   0   0    0     0<br />
126.com                  9   8   1  0  0  0   0   0   0    0     0<br />
aol.com                  8   6   2  0  0  0   0   0   0    0     0<br />
gmail.com                8   3   5  0  0  0   0   0   0    0     0<br />
microsoft.com            8   4   4  0  0  0   0   0   0    0     0</p>
<hr />
<h4>相关博文</h4>
]]></content:encoded>
			<wfw:commentRss>http://www.secblog.cn/unix/866.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache下禁止特定目录执行PHP</title>
		<link>http://www.secblog.cn/unix/854.html</link>
		<comments>http://www.secblog.cn/unix/854.html#comments</comments>
		<pubDate>Thu, 14 Oct 2010 07:49:43 +0000</pubDate>
		<dc:creator>豬頭濱</dc:creator>
				<category><![CDATA[Unix日志]]></category>

		<guid isPermaLink="false">http://www.secblog.cn/?p=854</guid>
		<description><![CDATA[如果用的是Apache服务器，还可以通过配置来禁止该目录下的PHP文件的访问，有两种方式： 方式一：.htaccess控制，适用于没有服务器管理权限。 在可写文件夹的目录下，建一个.htaccess文件，内容为： 复制代码 代码如下: &#60;Files ~ “.php”&#62; Order allow,deny Deny from all &#60;/Files&#62; 方式二：修改Apache配置文件，适用于有服务器管理权限。 配置中增加如下内容： 复制代码 代码如下: &#60;Directory “/www/users/unixidc.com”&#62; &#60;Files ~ “.php”&#62; Order allow,deny Deny from all &#60;/Files&#62; &#60;/Directory&#62; 别人用过的方法 &#60;Directory “/www/users/unixidc.com”&#62; &#60;FilesMatch “\.(php&#124;php3)$”&#62; Order allow,deny Deny from all &#60;/FilesMatch&#62; &#60;/Directory&#62; &#60;Directory /www/users/unixidc.com/upload1&#62; php_flag engine off &#60;/Directory&#62; &#60;Directory /www/users/unixidc.com/upload2&#62; php_flag engine off &#60;/Directory&#62;]]></description>
			<content:encoded><![CDATA[<p>如果用的是Apache服务器，还可以通过配置来禁止该目录下的PHP文件的访问，有两种方式：<br />
方式一：.htaccess控制，适用于没有服务器管理权限。<br />
在可写文件夹的目录下，建一个.htaccess文件，内容为：<br />
复制代码 代码如下:<br />
&lt;Files ~ “.php”&gt;<br />
Order allow,deny<br />
Deny from all<br />
&lt;/Files&gt;</p>
<p>方式二：修改Apache配置文件，适用于有服务器管理权限。<br />
配置中增加如下内容：<br />
复制代码 代码如下:<br />
&lt;Directory “/www/users/unixidc.com”&gt;<br />
&lt;Files ~ “.php”&gt;<br />
Order allow,deny<br />
Deny from all<br />
&lt;/Files&gt;<br />
&lt;/Directory&gt;</p>
<p>别人用过的方法</p>
<p>&lt;Directory “/www/users/unixidc.com”&gt;<br />
&lt;FilesMatch “\.(php|php3)$”&gt;<br />
Order allow,deny<br />
Deny from all<br />
&lt;/FilesMatch&gt;<br />
&lt;/Directory&gt;</p>
<p>&lt;Directory /www/users/unixidc.com/upload1&gt;<br />
php_flag engine off<br />
&lt;/Directory&gt;</p>
<p>&lt;Directory /www/users/unixidc.com/upload2&gt;<br />
php_flag engine off<br />
&lt;/Directory&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.secblog.cn/unix/854.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>让Discuz速度再次提升 ——“开启IIS Gzip压缩”</title>
		<link>http://www.secblog.cn/unix/844.html</link>
		<comments>http://www.secblog.cn/unix/844.html#comments</comments>
		<pubDate>Sun, 26 Sep 2010 16:20:53 +0000</pubDate>
		<dc:creator>豬頭濱</dc:creator>
				<category><![CDATA[Unix日志]]></category>

		<guid isPermaLink="false">http://www.secblog.cn/?p=844</guid>
		<description><![CDATA[未开启任何Gzip时：   开启了Discuz6.1后台的Gzip压缩：   开启Windows2003 II6中Gzip压缩：   通过以上数据对比，似乎提高了 0.33% 不足以说明什么。个人觉得当是一个较大网站的时候（前提硬件满足），开启它会明显使速度提高。（提升速度的同时，就是牺牲系统资源，所以如果服务器的配置不是太好，需要调整相关参数） 以上数据来源于 http://www.pipeboost.com ，进入后在这个位置输入网址：   【如何配置II6中Gzip压缩？】  注：以下教程，部分不给予太多说明，只要按照以下配置，一般不会出现问题（由于自身在配置时，很顺利，如果有遇到问题，首先请详细核对步骤3次，如果都正确，依然问题存在的话，请回复告知） 如果你要进行测试或安装，请一个一个字认真阅读！ 步骤一： 打开II6界面 &#62;  选择“网站” &#62; 右键属性 &#62; 选择“服务”&#62; 按照图中打钩 其中“临时目录的最大容量”与“临时目录”依据自身自行更改设置 特别注意，要给予临时目录 User权限（写入、修改、读取） 步骤二：  选择“Web服务扩展” &#62; 在右侧空白处右“键新Web服务扩展” &#62; 按照图输入相关 “设置扩展状态为可选”打钩 “添加文件”很可能由于每个人服务器配置不同，请自行搜索下（或者按照图中打入，看看是否存在） 步骤三： 开始 &#62; 运行中输入 c:\windows\system32\inetsrv （如果错误，请按照图中输入）&#62; 找到 MeteBase.xml 复制一份到桌面（并更改为 bak_MeteBase.xml），作为备份。    步骤四： 用文本等工具打开 MeteBase.xml &#62; 搜索 Location =”/LM/W3SVC/Filters/Compression/gzip” 然后，你将看到如下代码（仔细核对下段落） [...]]]></description>
			<content:encoded><![CDATA[<p>未开启任何Gzip时：<br />
<a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P0000K30.gif" target="_blank"><img src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P0000K30.gif" border="0" alt="" width="436" height="521" /></a> </p>
<p>开启了<span style="text-decoration: underline;">Discuz6.1</span>后台的Gzip压缩：<br />
<a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P00002C2.gif" target="_blank"><img src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P00002C2.gif" border="0" alt="" width="437" height="524" /></a> </p>
<p>开启Windows2003 II6中Gzip压缩：<br />
<a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P0000Ca.gif" target="_blank"><img src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P0000Ca.gif" border="0" alt="" width="441" height="505" /></a> </p>
<p>通过以上数据对比，似乎提高了 0.33% 不足以说明什么。个人觉得当是一个较大网站的时候（前提硬件满足），开启它会明显使速度提高。（提升速度的同时，就是牺牲系统资源，所以如果服务器的配置不是太好，需要调整相关参数）</p>
<p>以上数据来源于 <a href="http://www.pipeboost.com/">http://www.pipeboost.com</a> ，进入后在这个位置输入网址：<br />
<a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P00003T8.jpg" target="_blank"><img src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P00003T8.jpg" border="0" alt="" width="212" height="131" /></a> </p>
<p><span style="font-size: medium;"><strong>【如何配置II6中Gzip压缩？】</strong></span> <br />
注：以下教程，部分不给予太多说明，<span style="color: #ff0000;">只要</span>按照以下配置，一般不会出现问题（由于自身在配置时，很顺利，如果有遇到问题，首先请详细核对步骤3次，如果都正确，依然问题存在的话，请回复告知）</p>
<p><span style="color: #ff0000;">如果你要进行测试或安装，请一个一个字认真阅读！</p>
<p><strong>步骤一：<br />
</strong></span>打开II6界面 &gt;  选择“网站” &gt; 右键属性 &gt; 选择“服务”&gt; 按照图中打钩<br />
其中“临时目录的最大容量”与“<span style="color: #ff0000;">临时目录</span>”<span style="color: #ff0000;">依据自身自行更改设置<br />
特别注意，要给予临时目录 User权限（写入、修改、读取）</span><br />
<a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P000039A.jpg" target="_blank"><img title="在新窗口打开图片" src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P000039A.jpg" border="0" alt="" width="620" height="425" /></a></p>
<p><span style="color: #ff0000;"><strong>步骤二：</strong></span> <br />
选择“Web服务扩展” &gt; 在右侧空白处右“键新Web服务扩展” &gt; 按照图输入相关<br />
“设置扩展状态为可选”打钩<br />
“添加文件”很可能由于每个人服务器配置不同，请自行搜索下（或者按照图中打入，看看是否存在）<br />
<a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P0000EH.jpg" target="_blank"><img title="在新窗口打开图片" src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P0000EH.jpg" border="0" alt="" width="632" height="458" /></a></p>
<p><strong><span style="color: #ff0000;">步骤三：<br />
</span></strong>开始 &gt; 运行中输入 c:\windows\system32\inetsrv （如果错误，请按照图中输入）&gt; 找到 MeteBase.xml<br />
复制一份到桌面（并更改为 bak_MeteBase.xml），作为备份。<br />
<a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P0000H03.jpg" target="_blank"><img src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P0000H03.jpg" border="0" alt="" width="276" height="206" /></a>  </p>
<p><span style="color: #ff0000;"><strong>步骤四：<br />
</strong><span style="color: #000000;">用文本等工具打开 MeteBase.xml &gt; 搜索 Location =”/LM/W3SVC/Filters/Compression/gzip”</span><br />
<a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P0000IY.jpg" target="_blank"><strong><img title="在新窗口打开图片" src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P0000IY.jpg" border="0" alt="" width="586" height="234" /></strong></a></p>
<p></span><span style="color: #000000;">然后，你将看到如下代码（仔细核对下段落）<br />
&lt;IIsCompressionScheme Location =”/LM/W3SVC/Filters/Compression/deflate”<br />
  HcCompressionDll=”%windir%\system32\inetsrv\gzip.dll”<br />
  HcCreateFlags=”0&#8243;<br />
  HcDoDynamicCompression=”TRUE”<br />
  HcDoOnDemandCompression=”TRUE”<br />
  HcDoStaticCompression=”FALSE”<br />
  HcDynamicCompressionLevel=”0&#8243;<br />
  HcFileExtensions=”htm<br />
   html<br />
   txt”<br />
  HcOnDemandCompLevel=”10&#8243;<br />
  HcPriority=”1&#8243;<br />
  HcScriptFileExtensions=”asp<br />
   dll<br />
   exe”<br />
 &gt;<br />
&lt;/IIsCompressionScheme&gt;<br />
&lt;IIsCompressionScheme Location =”/LM/W3SVC/Filters/Compression/gzip”<br />
  HcCompressionDll=”%windir%\system32\inetsrv\gzip.dll”<br />
  HcCreateFlags=”1&#8243;<br />
  HcDoDynamicCompression=”TRUE”<br />
  HcDoOnDemandCompression=”TRUE”<br />
  HcDoStaticCompression=”TRUE”<br />
  HcDynamicCompressionLevel=”0&#8243;<br />
  HcFileExtensions=”htm<br />
   html<br />
   txt”<br />
  HcOnDemandCompLevel=”10&#8243;<br />
  HcPriority=”1&#8243;<br />
  HcScriptFileExtensions=”asp<br />
   dll<br />
   exe”<br />
 &gt;<br />
&lt;/IIsCompressionScheme&gt;</span></p>
<p><span style="color: #ff0000;">替换成：</span></p>
<p>&lt;IIsCompressionScheme Location =”/LM/W3SVC/Filters/Compression/gzip”<br />
  HcCompressionDll=”%windir%\system32\inetsrv\gzip.dll”<br />
  HcCreateFlags=”1&#8243;<br />
  HcDoDynamicCompression=”TRUE”<br />
  HcDoOnDemandCompression=”TRUE”<br />
  HcDoStaticCompression=”TRUE”<br />
<span style="color: #0000ff;">  HcDynamicCompressionLevel</span>=”10&#8243;<br />
<span style="color: #ff0000;">  HcFileExtensions</span>=”html<br />
   css<br />
   js<br />
   htm<br />
   xml<br />
   txt”<br />
  <span style="color: #0000ff;">HcOnDemandCompLevel</span>=”10&#8243;<br />
  HcPriority=”1&#8243;<br />
  <span style="color: #ff0000;">HcScriptFileExtensions</span>=”php<br />
   dll”<br />
 &gt;<br />
&lt;/IIsCompressionScheme&gt;<br />
&lt;IIsCompressionScheme Location =”/LM/W3SVC/Filters/Compression/deflate”<br />
  HcCompressionDll=”%windir%\system32\inetsrv\gzip.dll”<br />
  HcCreateFlags=”2&#8243;<br />
  HcDoDynamicCompression=”TRUE”<br />
  HcDoOnDemandCompression=”TRUE”<br />
  HcDoStaticCompression=”TRUE”<br />
  HcDynamicCompressionLevel=”10&#8243;<br />
  <span style="color: #000000;">HcFileExtensions=</span><span style="color: #000000;">“</span>html<br />
   css<br />
   js<br />
   htm<br />
   xml<br />
   txt”<br />
<span style="color: #000000;">  HcOnDemandCompLevel</span>=”10&#8243;<br />
  HcPriority=”1&#8243;<br />
<span style="color: #000000;">  HcScriptFileExtensions=”</span>php<br />
   dll”<br />
 &gt;<br />
&lt;/IIsCompressionScheme&gt;</p>
<p><span style="color: #ff0000;">红色</span>部分为你要压缩的<span style="text-decoration: underline;">文件类型</span>，请自行增加。<span style="color: #ff0000;">上方为静态类文件，下方为动态类文件。<br />
</span><span style="color: #000000;"><span style="color: #0000ff;">蓝色</span>部分为<span style="text-decoration: underline;">压缩等级</span>，数值为 0-10 ，请自行根据服务器硬件等环境来做调试（可以先用文章开头时提到的网址，先测试并记录“未开启任何Gzip的数值”与“开启Discuz6.1后台Gzip数值”，然后配置完成，再记录“开启IIS6下的Gzip时的数值”，3个就可以进行对比了）</span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;"><span style="color: #ff0000;">然后请先保存到桌面，名为 MeteBase.xml</span><br />
</span><a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P000042G.jpg" target="_blank"><strong><img title="在新窗口打开图片" src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P000042G.jpg" border="0" alt="" width="559" height="438" /></strong></a> </span> </p>
<p><span style="color: #ff0000;"><strong>步骤五：<br />
</strong><span style="color: #000000;">我的电脑 &gt; 控制面板 &gt; 管理工具 &gt; 服务<br />
找到 IIS Admin Service &gt; </span><span style="color: #ff0000;">停止</span><br />
<a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P000021N.jpg" target="_blank"><strong><img src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P000021N.jpg" border="0" alt="" width="474" height="279" /></strong></a> </span></p>
<p><span style="color: #ff0000;"><strong>步骤六：<br />
</strong><span style="color: #000000;">回到找到 MeteBase.xml 的目录，删除它</span><br />
<a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P00009150.jpg" target="_blank"><strong><img src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P00009150.jpg" border="0" alt="" width="471" height="320" /></strong></a> </span></p>
<p><span style="color: #ff0000;"><strong>步骤七：<br />
</strong><span style="color: #000000;">在步骤四的最后，让大家保存到了桌面，现在我们剪切它。</span><br />
<a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P00001501.jpg" target="_blank"><strong><img src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P00001501.jpg" border="0" alt="" width="133" height="169" /></strong></a> </span></p>
<p><span style="color: #ff0000;"><strong>步骤八：<br />
</strong><span style="color: #000000;">回到刚才删除 MeteBase.xml 的地方，把从桌面剪切的粘贴进来</span><br />
<a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P000041C.jpg" target="_blank"><strong><img src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P000041C.jpg" border="0" alt="" width="340" height="176" /></strong></a><strong> </strong></span></p>
<p><span style="color: #ff0000;"><strong>步骤九：<br />
</strong><span style="color: #000000;">在步骤五中，我们停止了 IIS Admin Service 服务，现在，我们点<span style="color: #ff0000;">启动</span>它。（图与步骤五一样，所以请以实际的为准）<br />
</span><strong><img src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P000021N.jpg" border="0" alt="" width="474" height="279" /></strong></span></p>
<p><span style="color: #ff0000;"><strong>步骤十：<br />
</strong></span><span style="color: #ff0000;"><span style="color: #000000;">回到II6中，对其进行重启IIS</span><br />
<a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P0000c17.jpg" target="_blank"><strong><img title="在新窗口打开图片" src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P0000c17.jpg" border="0" alt="" width="513" height="361" /></strong></a> </span></p>
<p><span style="color: #ff0000;"><strong>步骤十一：<br />
</strong><span style="color: #000000;">进入Discuz6.1后台，关闭 Gzip 压缩（重要）<br />
如果不关闭，压缩效果将会降低 0.33%</span> （不关闭，则就是2个Gzip压缩了，而输出时，将优先使用Discuz6.1后台的，所以会下降，一定要关闭）<br />
<a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P00009600.jpg" target="_blank"><strong><img title="在新窗口打开图片" src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P00009600.jpg" border="0" alt="" width="525" height="290" /></strong></a> </span></p>
<p><span style="color: #ff0000;"><strong>步骤十二：<br />
</strong><span style="color: #000000;">更新Disucz6.1缓存，如图勾选<br />
</span><a href="http://www.zzchn.com/upimg/userup/11872/11W20F01010P00002a5.jpg" target="_blank"><img src="http://www.zzchn.com/upimg/userup/11872/11W20F01010P00002a5.jpg" border="0" alt="" width="205" height="116" /></a> </span></p>
<p><span style="color: #0000ff;"><span style="color: #000000;">       </span>到此，就配置完毕了！以上教程可能对于部分人来啰嗦，但出于配置考虑，比较详细。另外Disucz6.1后台的Gzip压缩相当于压缩等级 9，这里我们调整成了10 。就我个人感觉，Discuz6.1后台开启的Gzip压缩会有比较明显的<span style="text-decoration: underline;">点击</span>停顿，不过很可能能是人感觉，有兴趣的朋友可以反复测试一下！写了3小时的教程，一些地方如果不足或错误，请指出，请勿用不文明的语言：）</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.secblog.cn/unix/844.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>网站性能优化之Gzip压缩</title>
		<link>http://www.secblog.cn/unix/841.html</link>
		<comments>http://www.secblog.cn/unix/841.html#comments</comments>
		<pubDate>Sun, 26 Sep 2010 16:18:43 +0000</pubDate>
		<dc:creator>豬頭濱</dc:creator>
				<category><![CDATA[Unix日志]]></category>

		<guid isPermaLink="false">http://www.secblog.cn/?p=841</guid>
		<description><![CDATA[ZIP压缩其实就是将网页内容压缩，减少HTML代码网络传输的代价，来提高Web性能. 请求的过程如下: 1：客户端Request请求。Http_header中会根据相应的浏览器发送相应的编码规则 Accept:*/* Accept-Encoding:gzip,defate User-Agent:OpenWave 这表明“我”客户端浏览器可以支持gzip、deflate两种压缩格式。 2：服务器端接受到这个“Accept-Encodeing”，服务器就可以采用相应的gizp、defalte，压缩web内容，并 Response。如： Date: Mon, 19 Oct 2009 10:07:16 GMT Server: Apache/2.2.8 (Win32) DAV/2 SVN/1.4.6 PHP/5.2.6 X-Powered-By: PHP/5.2.6 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Vary: Accept-Encoding Content-Encoding: gzip Content-Length: 3871 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html 3：客户端浏览器接受到相应压缩后的内容，根据”Content-Encoding:gzip”,进行相应解压缩，并呈现给用户 Apache配置过程如下: 1.开启mod_headers模块 [...]]]></description>
			<content:encoded><![CDATA[<p>ZIP压缩其实就是将网页内容压缩，减少HTML代码网络传输的代价，来提高Web性能.<br />
<strong>请求的过程如下:</strong><br />
1：客户端Request请求。Http_header中会根据相应的浏览器发送相应的编码规则<br />
Accept:*/*<br />
Accept-Encoding:gzip,defate<br />
User-Agent:OpenWave</p>
<p>这表明“我”客户端浏览器可以支持gzip、deflate两种压缩格式。<br />
2：服务器端接受到这个“Accept-Encodeing”，服务器就可以采用相应的gizp、defalte，压缩web内容，并<br />
Response。如：</p>
<p>Date: Mon, 19 Oct 2009 10:07:16 GMT<br />
Server: Apache/2.2.8 (Win32) DAV/2 SVN/1.4.6 PHP/5.2.6<br />
X-Powered-By: PHP/5.2.6<br />
Expires: Thu, 19 Nov 1981 08:52:00 GMT<br />
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0<br />
Pragma: no-cache<br />
Vary: Accept-Encoding<br />
Content-Encoding: gzip<br />
Content-Length: 3871<br />
Keep-Alive: timeout=5, max=100<br />
Connection: Keep-Alive<br />
Content-Type: text/html<br />
3：客户端浏览器接受到相应压缩后的内容，根据”Content-Encoding:gzip”,进行相应解压缩，并呈现给用户<br />
<strong><br />
Apache配置过程如下:</strong><br />
1.开启mod_headers模块<br />
LoadModule headers_module modules/mod_headers.so<br />
2.开启mod_deflate模块<br />
LoadModule deflate_module modules/mod_deflate.so<br />
3.配置mod_deflate模块，让其压缩html xml css php js等文件：<br />
&lt;ifmodule mod_deflate.c&gt;<br />
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-httpd-php application/x-javascript<br />
AddOutputFilter DEFLATE html xml css php js<br />
&lt;/ifmodule&gt;<br />
4.重启apche在phpinfo页面中能找到如:Accept-Encoding gzip,deflate 等表示配置成功<br />
   你还可通过firefox的插件YSlow查看文件的原始大小和通过gzip压缩后的大小</p>
]]></content:encoded>
			<wfw:commentRss>http://www.secblog.cn/unix/841.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>淘宝图片存储与CDN系统 &#8211;淘宝核心系统部</title>
		<link>http://www.secblog.cn/unix/837.html</link>
		<comments>http://www.secblog.cn/unix/837.html#comments</comments>
		<pubDate>Mon, 30 Aug 2010 08:49:03 +0000</pubDate>
		<dc:creator>豬頭濱</dc:creator>
				<category><![CDATA[Unix日志]]></category>

		<guid isPermaLink="false">http://www.secblog.cn/?p=837</guid>
		<description><![CDATA[http://www.docin.com/p-57729070.html]]></description>
			<content:encoded><![CDATA[<p>http://www.docin.com/p-57729070.html</p>
]]></content:encoded>
			<wfw:commentRss>http://www.secblog.cn/unix/837.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Banned the following ip addresses on</title>
		<link>http://www.secblog.cn/unix/816.html</link>
		<comments>http://www.secblog.cn/unix/816.html#comments</comments>
		<pubDate>Wed, 11 Aug 2010 08:12:00 +0000</pubDate>
		<dc:creator>豬頭濱</dc:creator>
				<category><![CDATA[Unix日志]]></category>

		<guid isPermaLink="false">http://www.secblog.cn/?p=816</guid>
		<description><![CDATA[请查看/usr/local/ddos/ddos.sh文件的第117行 netstat -ntu &#124; awk &#8216;{print $5}&#8217; &#124; cut -d: -f1 &#124; sort &#124; uniq -c &#124; sort -nr > $BAD_IP_LIST 修改为以下代码即可！ netstat -ntu &#124; grep &#8216;:&#8217; &#124; awk &#8216;{print $5}&#8217; &#124; sed &#8216;s/::ffff://&#8217; &#124; cut -f1 -d &#8216;:&#8217; &#124; sort &#124; uniq -c &#124; sort -nr > $BAD_IP_LIST]]></description>
			<content:encoded><![CDATA[<p>请查看/usr/local/ddos/ddos.sh文件的第117行<br />
netstat -ntu | awk &#8216;{print $5}&#8217; | cut -d: -f1 | sort | uniq -c | sort -nr > $BAD_IP_LIST<br />
修改为以下代码即可！<br />
netstat -ntu | grep &#8216;:&#8217; | awk &#8216;{print $5}&#8217; | sed &#8216;s/::ffff://&#8217; | cut -f1 -d &#8216;:&#8217; | sort | uniq -c | sort -nr > $BAD_IP_LIST</p>
]]></content:encoded>
			<wfw:commentRss>http://www.secblog.cn/unix/816.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

