﻿<?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>Gavin&#039;s Blog &#187; wordpress</title>
	<atom:link href="http://laigw.name/cat/tech/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://laigw.name</link>
	<description>Keep it simple, stupid. Simplicity is beauty.</description>
	<lastBuildDate>Sun, 29 Jan 2012 07:14:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Nginx下用cos-html-cache实现WordPress的真静态化</title>
		<link>http://laigw.name/post/248.html</link>
		<comments>http://laigw.name/post/248.html#comments</comments>
		<pubDate>Wed, 19 Nov 2008 10:51:48 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[cos-html-cache]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[静态化]]></category>

		<guid isPermaLink="false">http://www.laigw.name/?p=248</guid>
		<description><![CDATA[由于感觉自己的wordpress访问越来越慢，就狠下心来实现本博客的页面真静态化(之前已经通过Nginx的URL Rewrite实现了伪静态化)。在网上Google了一下，发现了cos-html-cache这个插件，口碑不错，就down下来装了。按照文档一路装下来，挺顺利的。现特记下来备忘。

一、安装步骤：
1、到这里下载插件。我安装的是当期最新版本：v2.6.1；
2、解压缩，确保文件夹里面没有二级目录，然后将其放置到插件目录下，插件目录通常是 `wp-content/plugins/`。Linux下则用命令：
$unzip cos-html-cache.zip
3、在wordpress后台对应的插件管理页激活该插件；
4、更改wordpress的Permalinks(永久链接)为非默认设置，我的是：/article/%post_id%.html；
5、确保gzip已经禁用，请到对应的页面检查设置：http://你wp的地址/wp-admin/options-reading.php(注：我的wordpress是2.6.3版本，没文档上的该设置)；
6、在网站的根目录下创建一个文件 &#8220;index.bak&#8221;，并将属性设置成0666；
7、在网站的根目录下创建一个目录article(对应/article/%post_id%.html中的目录)，并将文件夹属性设置成0777：
#chmod 0777 article/
8、安装完成。
当前端用户访问首页或者相应文章的url时，插件将会自动检测是否已经生成静态文件，如果没有，则于目录html/下生成相应的静态文件。静态文件会在文档末尾添加一句：

二、注意事项：
1、cos-html-cache只当前只能生成首页及文章的静态文件。如果不想首页生成静态文件，则可修改cos-html-cache.php(通过wordpress的后台可以edit)的
define(&#8216;IS_INDEX&#8217;,true);// false = do not create home page cache
为
define(&#8216;IS_INDEX&#8217;,false);// true = do create home page cache
则可。
2、我的Web服务器是Nginx，需要URL Rewrite，如果你也需要URL Rewrite，可以参考以下我的Nginx的虚拟机设置：

&#160;查看代码 DIV1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#
# www.laigw.name virtual host setting
#
server
&#123;
	listen       80;
	server_name  www.laigw.name laigw.name;
	index index.htm index.html index.php;
	root  /srv/nginx/laigw;
&#160;
	location / &#123;
		if &#40;-f $request_filename/index.html&#41;&#123;
		        [...]]]></description>
		<wfw:commentRss>http://laigw.name/post/248.html/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

