<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[张宴的博客]]></title> 
<link>http://zyan.cc/index.php</link> 
<description><![CDATA[Web系统架构与底层研发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[张宴的博客]]></copyright>
<item>
<link>http://zyan.cc/nginx_cache/</link>
<title><![CDATA[使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[Cache与存储]]></category>
<pubDate>Mon, 11 Jan 2010 10:20:28 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/</guid> 
<description>
<![CDATA[ 
	　　[文章作者：张宴 本文版本：v1.2 最后修改：2009.01.12 转载请注明原文链接：<a href="http://blog.zyan.cc/nginx_cache/" target="_blank">http://blog.zyan.cc/nginx_cache/</a>]<br/><br/>　　Nginx从0.7.48版本开始，支持了类似Squid的缓存功能。这个缓存是把URL及相关组合当作Key，用md5编码哈希后保存在硬盘上，所以它可以支持任意URL链接，同时也支持404/301/302这样的非200状态码。虽然目前官方的Nginx Web缓存服务只能为指定URL或状态码设置过期时间，不支持类似Squid的PURGE指令，手动清除指定缓存页面，但是，通过一个第三方的Nginx模块，可以清除指定URL的缓存。<br/><br/>　　Nginx的Web缓存服务主要由proxy_cache相关指令集和fastcgi_cache相关指令集构成，前者用于反向代理时，对后端内容源服务器进行缓存，后者主要用于对FastCGI的动态程序进行缓存。两者的功能基本上一样。<br/><br/>　　最新的Nginx 0.8.32版本，proxy_cache和fastcgi_cache已经比较完善，加上第三方的ngx_cache_purge模块（用于清除指定URL的缓存），已经可以完全取代Squid。我们已经在生产环境使用了 Nginx 的 proxy_cache 缓存功能超过两个月，十分稳定，速度不逊于 Squid。<br/><br/>　　在功能上，Nginx已经具备Squid所拥有的Web缓存加速功能、清除指定URL缓存的功能。而在性能上，Nginx对多核CPU的利用，胜过Squid不少。另外，在反向代理、负载均衡、健康检查、后端服务器故障转移、Rewrite重写、易用性上，Nginx也比Squid强大得多。这使得一台Nginx可以同时作为“负载均衡服务器”与“Web缓存服务器”来使用。<br/>　　<br/><hr/><br/>　　1、Nginx 负载均衡与缓存服务器在 Linux 下的编译安装：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">ulimit -SHn 65535<br/>wget <a href="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.00.tar.gz" target="_blank">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.00.tar.gz</a><br/>tar zxvf pcre-8.00.tar.gz<br/>cd pcre-8.00/<br/>./configure<br/>make && make install<br/>cd ../<br/><br/>wget <a href="http://labs.frickle.com/files/ngx_cache_purge-1.0.tar.gz" target="_blank">http://labs.frickle.com/files/ngx_cache_purge-1.0.tar.gz</a><br/>tar zxvf ngx_cache_purge-1.0.tar.gz<br/><br/>wget <a href="http://nginx.org/download/nginx-0.8.32.tar.gz" target="_blank">http://nginx.org/download/nginx-0.8.32.tar.gz</a><br/>tar zxvf nginx-0.8.32.tar.gz<br/>cd nginx-0.8.32/<br/>./configure --user=www --group=www --add-module=../ngx_cache_purge-1.0 --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module<br/>make && make install<br/>cd ../</div><br/><hr/><br/>　　2、/usr/local/webserver/nginx/conf/nginx.conf 配置文件内容如下：<br/><div class="code">user&nbsp;&nbsp;www www;<br/><br/>worker_processes 8;<br/><br/>error_log&nbsp;&nbsp;/usr/local/webserver/nginx/logs/nginx_error.log&nbsp;&nbsp;crit;<br/><br/>pid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/usr/local/webserver/nginx/nginx.pid;<br/><br/>#Specifies the value for maximum file descriptors that can be opened by this process. <br/>worker_rlimit_nofile 65535;<br/><br/>events <br/>&#123;<br/>&nbsp;&nbsp;use epoll;<br/>&nbsp;&nbsp;worker_connections 65535;<br/>&#125;<br/><br/>http <br/>&#123;<br/>&nbsp;&nbsp;include&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mime.types;<br/>&nbsp;&nbsp;default_type&nbsp;&nbsp;application/octet-stream;<br/><br/>&nbsp;&nbsp;charset&nbsp;&nbsp;utf-8;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;server_names_hash_bucket_size 128;<br/>&nbsp;&nbsp;client_header_buffer_size 32k;<br/>&nbsp;&nbsp;large_client_header_buffers 4 32k;<br/>&nbsp;&nbsp;client_max_body_size 300m;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;sendfile on;<br/>&nbsp;&nbsp;tcp_nopush&nbsp;&nbsp;&nbsp;&nbsp; on;<br/><br/>&nbsp;&nbsp;keepalive_timeout 60;<br/><br/>&nbsp;&nbsp;tcp_nodelay on;<br/><br/>&nbsp;&nbsp;client_body_buffer_size&nbsp;&nbsp;512k;<br/>&nbsp;&nbsp;proxy_connect_timeout&nbsp;&nbsp;&nbsp;&nbsp;5;<br/>&nbsp;&nbsp;proxy_read_timeout&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 60;<br/>&nbsp;&nbsp;proxy_send_timeout&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5;<br/>&nbsp;&nbsp;proxy_buffer_size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16k;<br/>&nbsp;&nbsp;proxy_buffers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4 64k;<br/>&nbsp;&nbsp;proxy_busy_buffers_size 128k;<br/>&nbsp;&nbsp;proxy_temp_file_write_size 128k;<br/><br/>&nbsp;&nbsp;gzip on;<br/>&nbsp;&nbsp;gzip_min_length&nbsp;&nbsp;1k;<br/>&nbsp;&nbsp;gzip_buffers&nbsp;&nbsp;&nbsp;&nbsp; 4 16k;<br/>&nbsp;&nbsp;gzip_http_version 1.1;<br/>&nbsp;&nbsp;gzip_comp_level 2;<br/>&nbsp;&nbsp;gzip_types&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text/plain application/x-javascript text/css application/xml;<br/>&nbsp;&nbsp;gzip_vary on;<br/><br/>&nbsp;&nbsp;#注：proxy_temp_path和proxy_cache_path指定的路径必须在同一分区<br/>&nbsp;&nbsp;proxy_temp_path&nbsp;&nbsp; /data0/proxy_temp_dir;<br/>&nbsp;&nbsp;#设置Web缓存区名称为cache_one，内存缓存空间大小为200MB，1天没有被访问的内容自动清除，硬盘缓存空间大小为30GB。<br/>&nbsp;&nbsp;proxy_cache_path&nbsp;&nbsp;/data0/proxy_cache_dir&nbsp;&nbsp;levels=1:2&nbsp;&nbsp; keys_zone=cache_one:200m inactive=1d max_size=30g;<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;upstream backend_server &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;server&nbsp;&nbsp; 192.168.8.43:80 weight=1 max_fails=2 fail_timeout=30s;<br/>&nbsp;&nbsp;&nbsp;&nbsp;server&nbsp;&nbsp; 192.168.8.44:80 weight=1 max_fails=2 fail_timeout=30s;<br/>&nbsp;&nbsp;&nbsp;&nbsp;server&nbsp;&nbsp; 192.168.8.45:80 weight=1 max_fails=2 fail_timeout=30s;<br/>&nbsp;&nbsp;&#125;<br/><br/>&nbsp;&nbsp;server<br/>&nbsp;&nbsp;&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;listen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 80;<br/>&nbsp;&nbsp;&nbsp;&nbsp;server_name&nbsp;&nbsp;www.yourdomain.com 192.168.8.42;<br/>&nbsp;&nbsp;&nbsp;&nbsp;index index.html index.htm;<br/>&nbsp;&nbsp;&nbsp;&nbsp;root&nbsp;&nbsp;/data0/htdocs/www;&nbsp;&nbsp;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;location /<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #如果后端的服务器返回502、504、执行超时等错误，自动将请求转发到upstream负载均衡池中的另一台服务器，实现故障转移。<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_next_upstream http_502 http_504 error timeout invalid_header;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_cache cache_one;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #对不同的HTTP状态码设置不同的缓存时间<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_cache_valid&nbsp;&nbsp;200 304 12h;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #以域名、URI、参数组合成Web缓存的Key值，Nginx根据Key值哈希，存储缓存内容到二级缓存目录内<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_cache_key $host$uri$is_args$args;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_set_header Host&nbsp;&nbsp;$host;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_set_header X-Forwarded-For&nbsp;&nbsp;$remote_addr;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_pass http://backend_server;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; expires&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1d;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;#用于清除缓存，假设一个URL为http://192.168.8.42/test.txt，通过访问http://192.168.8.42/purge/test.txt就可以清除该URL的缓存。<br/>&nbsp;&nbsp;&nbsp;&nbsp;location ~ /purge(/.*)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp; #设置只允许指定的IP或IP段才可以清除URL缓存。<br/>&nbsp;&nbsp;&nbsp;&nbsp; allow&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;127.0.0.1;<br/>&nbsp;&nbsp;&nbsp;&nbsp; allow&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;192.168.0.0/16;<br/>&nbsp;&nbsp;&nbsp;&nbsp; deny&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;all;<br/>&nbsp;&nbsp;&nbsp;&nbsp; proxy_cache_purge&nbsp;&nbsp;&nbsp;&nbsp;cache_one&nbsp;&nbsp; $host$1$is_args$args;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;#扩展名以.php、.jsp、.cgi结尾的动态应用程序不缓存。<br/>&nbsp;&nbsp;&nbsp;&nbsp;location ~ .*&#92;.(php&#124;jsp&#124;cgi)?$<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_set_header Host&nbsp;&nbsp;$host;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_set_header X-Forwarded-For&nbsp;&nbsp;$remote_addr;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_pass http://backend_server;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;access_log&nbsp;&nbsp;off;<br/>&nbsp;&nbsp;&#125;<br/>&#125;</div><br/><hr/><br/>　　3、启动 Nginx：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">/usr/local/webserver/nginx/sbin/nginx</div><br/><br/><hr/><br/>　　4、清除指定的URL缓存示例：<br/><br/>　　<a href="http://zyan.cc/attachment/201001/nginx_purge.png" target="_blank"><img src="http://zyan.cc/attachment/201001/nginx_purge.png" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>Tags - <a href="http://zyan.cc/tags/nginx/" rel="tag">nginx</a> , <a href="http://zyan.cc/tags/proxy/" rel="tag">proxy</a> , <a href="http://zyan.cc/tags/cache/" rel="tag">cache</a> , <a href="http://zyan.cc/tags/webcache/" rel="tag">webcache</a> , <a href="http://zyan.cc/tags/squid/" rel="tag">squid</a> , <a href="http://zyan.cc/tags/varnish/" rel="tag">varnish</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4762</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>挥舞尘埃 &lt;lostdust@gmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 11 Jan 2010 13:28:37 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4762</guid> 
<description>
<![CDATA[ 
	谢谢~！
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4763</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>Cat. &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 11 Jan 2010 14:06:14 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4763</guid> 
<description>
<![CDATA[ 
	没均衡服务器,该怎么弄啊?
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4764</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>折扣族 &lt;share@zhekouzu.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 11 Jan 2010 15:43:31 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4764</guid> 
<description>
<![CDATA[ 
	强大，nginx最近像也是要released了。
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4765</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>dd_macle &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 12 Jan 2010 01:51:21 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4765</guid> 
<description>
<![CDATA[ 
	真不错，学习了
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4766</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>dhyong &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 12 Jan 2010 01:55:44 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4766</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4768</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>suchasplus &lt;suchasplus@gmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 12 Jan 2010 05:49:17 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4768</guid> 
<description>
<![CDATA[ 
	1.作为ncache的nginx集成版, proxy_cache是没有办法支持ICP协议的<br/>2.处于block的考虑, 还是跑一个lighttpd+mod_cache吧..
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4769</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>怪物宝 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 12 Jan 2010 06:04:30 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4769</guid> 
<description>
<![CDATA[ 
	呵呵，大侠真是我的偶像
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4770</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>Tiger &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 12 Jan 2010 07:58:00 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4770</guid> 
<description>
<![CDATA[ 
	哎，我啥时候也这么强呢
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4777</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>jee-liu &lt;ljb-2000@163.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Wed, 13 Jan 2010 02:49:00 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4777</guid> 
<description>
<![CDATA[ 
	是否能考虑用 lvs +nginx 做为CND加速分站，这里要考虑purge效率
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4778</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>IT渠道网 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Wed, 13 Jan 2010 13:32:23 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4778</guid> 
<description>
<![CDATA[ 
	已经用上了。感觉不错。
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4783</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>逍遥 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 15 Jan 2010 01:33:35 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4783</guid> 
<description>
<![CDATA[ 
	请教张兄&nbsp;&nbsp;nginx_cache 是否能取本地的文件在缓存？ 我们是把网内的一个文件 mount到了本地 /mnt/data ,想通过nginx读取静态文件然后缓存，我的配置如下，现在不工作，请指点，多谢了<br/>proxy_temp_path&nbsp;&nbsp; /data1/proxy_temp_dir;<br/>&nbsp;&nbsp;proxy_cache_path&nbsp;&nbsp;/data1/proxy_cache_dir&nbsp;&nbsp;levels=1:2&nbsp;&nbsp; keys_zone=cache_one:200m inactive=1d max_size=30g;<br/> <br/>&nbsp;&nbsp;#upstream backend_server &#123;<br/>&nbsp;&nbsp; # server&nbsp;&nbsp; 192.168.8.43:80 weight=1 max_fails=2 fail_timeout=30s;<br/>&nbsp;&nbsp;&nbsp;&nbsp;#server&nbsp;&nbsp; 192.168.8.44:80 weight=1 max_fails=2 fail_timeout=30s;<br/>&nbsp;&nbsp;&nbsp;&nbsp;#server&nbsp;&nbsp; 192.168.8.45:80 weight=1 max_fails=2 fail_timeout=30s;<br/>&nbsp;&nbsp;#&#125;<br/><br/>&nbsp;&nbsp;server<br/>&nbsp;&nbsp;&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;listen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 80;<br/>&nbsp;&nbsp;&nbsp;&nbsp;server_name&nbsp;&nbsp;image[1-5].idoican.com.cn 220.194.53.217;<br/>&nbsp;&nbsp;&nbsp;&nbsp;index index.html index.htm index.txt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;sendfile off;<br/>&nbsp;&nbsp;error_page 404 /404.html;<br/>&nbsp;&nbsp;location ~ .*\.(jpg&#124;xml&#124;gif&#124;png)?$<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#123;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root /mnt/data;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_next_upstream http_502 http_504 error timeout invalid_header;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_cache cache_one;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_cache_valid&nbsp;&nbsp;200 304 12h;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_cache_valid&nbsp;&nbsp;301 302 1h;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_cache_key $host$uri$is_args$args;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_set_header Host&nbsp;&nbsp;$host;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_set_header X-Forwarded-For&nbsp;&nbsp;$remote_addr;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; expires&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1d;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4789</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>badb0y &lt;h3ewhack@163.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 15 Jan 2010 11:45:07 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4789</guid> 
<description>
<![CDATA[ 
	[root@linglingshang2009 nginx]# /usr/local/nginx/sbin/nginx -t<br/>the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok<br/>[alert]: mmap(MAP_ANON&#124;MAP_SHARED, 209715200) failed (28: No space left on device)<br/>configuration file /usr/local/nginx/conf/nginx.conf test failed<br/><br/>OPENVZ的VPS不支持，，XEN的支持，郁闷中
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4795</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>最美别墅 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sat, 16 Jan 2010 06:45:37 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4795</guid> 
<description>
<![CDATA[ 
	不错不错，每次有新文章多少都有收获。赞赞
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4797</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>江南证券 &lt;onmove@sina.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sat, 16 Jan 2010 08:18:35 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4797</guid> 
<description>
<![CDATA[ 
	初学者 来此多取经
]]>
</description>
</item><item>
<link>http://zyan.cc/nginx_cache/#blogcomment4799</link>
<title><![CDATA[[评论] 使用Nginx的proxy_cache缓存功能取代Squid[原创]]]></title> 
<author>双色球论坛 &lt;onmove@sina.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sat, 16 Jan 2010 08:19:14 +0000</pubDate> 
<guid>http://zyan.cc/nginx_cache/#blogcomment4799</guid> 
<description>
<![CDATA[ 
	我只是it民工还有很多问题没搞清
]]>
</description>
</item>
</channel>
</rss>