配置Kloxo下的lighttpd支持WP Super Cache

四月 12, 2010 by · Leave a Comment 

1,安装make

我的VPS用的系统是CentOs5,貌似没有make,执行make时会提示“Make Command not Found ”,需要手动安装一下,稍后几个步骤会用到。

yum -y install gcc automake autoconf libtool make

2,安装lua环境

因为在lighttpd下的WP Super Cache需要用到lua脚本,所以先要安装lua环境,具体步骤如下:

wget http://www.lua.org/ftp/lua-5.1.4.tar.gz
tar -xzvf lua-5.1.4.tar.gz
cd lua-5.1.4
yum install libtermcap-devel
yum install ncurses-devel
yum install libevent-devel
yum install readline-devel
make linux
make install

这样,lua环境就算安装完毕了。

3,重新编译lighttpd

wget http://download..net//releases-1.4.x/-1.4.26.tar.gz
tar -xzvf -1.4.26.tar.gz
cd -1.4.26
export LUA_CFLAGS="-I/usr/local/include"
export LUA_LIBS="-L/usr/local/lib -llua"
yum install openssl openssl-devel
yum install flex autoconf zlib curl zlib-devel curl-devel bzip2 bzip2-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel
yum install pcre-devel
./configure --with-pcre --with-lua --with-zlib --with-openssl --sbindir=/usr/sbin --sysconfdir=/etc/
make
make install

到这里lighttpd重新编译完毕。

4,修改lighttpd配置文件

vim /etc/lighttpd/lighttpd.conf

找到server.modules,在其中加一行”mod_magnet”,如:

server.modules =
(
"mod_rewrite",
"mod_redirect",
"mod_alias",
"mod_access",
"mod_magnet",
... ...

6,上传rewrite.lua,添加重写规则

下载rewrite.lua,上传至博客根目录,进入Kloxo,选择域名,选择博客的域名,然后选择lighttpd地址重写规则,如图 加入如下规则:

$HTTP["host"] == "www.qifendi.com" {
       server.error-handler-404 = "/index.php"
       server.document-root = "/home/admin/xxx" #填写博客根目录
        magnet.attract-physical-path-to = ( server.document-root + "/rewrite.lua" )
}

7,重启lighttpd。

yum downgrade openssl
/etc/init.d/lighttpd restart

8,权限设置

访问博客,如果报500错误,将/wp-content/cache/和/wp-content/cache/supercache/权限设置为755 这时候虽然WP Super Cache还在报Mod rewrite may not be installed!,但是实际上已经有作用了。如果操作过程中不慎把Kloxo搞挂了,可以用下面的命令重启一下:

 /etc/init.d/kloxo restart

转载自:七分地

About admin

注意:

1、本站启用了审核机制,你的留言可能稍后才会显示,请不要重复提交,谢谢。
2、留言时的头像是Gravatar提供的服务。想设置的看这里
3、评论者允许使用'@user空格'的方式将自己的评论通知另外评论者。

To submit your comment, click the image below where it asks you to...
Clickcha - The One-Click Captcha