用lighttpd代替apache

用apache真TM耗资源,至少对于我来说,512M内存完全不够用,于是换到了lighttpd,也没啥难度的,就是碰到了几个问题:

1.虚拟主机配置,在lighttpd.conf里面加入以下内容

$HTTP["host"] == "blog.programcareer.net" {
        server.name = "blog.programcareer.net"
        server.document-root = "/var/www/blog.programcareer.net"
        server.errorlog = "/var/log/lighttpd/wp-error.log"
        accesslog.filename = "/var/log/lighttpd/wp-access.log"
}

 

2.固定url重写问题,在lighttpd.conf加入以下内容

url.rewrite-once = ( 
    "^/(wp-.+).*/?" => "$0", 
    "^/(sitemap.xml)" => "$0", 
    "^/(xmlrpc.php)" => "$0", 
    "^/keyword/([A-Za-z_0-9-]+)/?$" => "/index.php?keyword=$1", 
    "^/.*?(?.*)?$" => "/index.php$1" 
)

 

3.安装php5-cgi

Published: November 02 2011

  • category: