lighttpd 1.5从06年到现在一直都没有放出一个稳定的版本出来,不知道现在的开发者是怎么计划的。1.5比1.4的功能貌似变化不多,最大的变化是改写了proxy模块,原先的fastcgi模块也被proxy所取代,从1.4.X升级的话就需要做一些修改。

1. 从svn check out 1.5的源代码 svn checkout svn://svn.lighttpd.net/lighttpd/trunk

2. 编译源码 编译过程可以参考源码目录下的INSTALL.svn $ ./autogen.sh $ ./configure --prefix=/usr/local/light --with-pcre=/usr/local/light $ make $ make install

注:编译时,如果没有glib2-devel库会报错找不到gthread-2.0,需要安装glib2-devel checking for GTHREAD... configure: error: Package requirements (gthread-2.0 >= 2.4.0) were not met:

No package 'gthread-2.0' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

Alternatively, you may set the environment variables GTHREAD_CFLAGS and GTHREAD_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.

3. 修改配置文件 vi /usr/local/light/etc/lighttpd.conf 删除server.modules中 “mod_fastcgi”, “mod_proxy”, 的配置,增加模块 “mod_proxy_core”, “mod_proxy_backend_fastcgi” : server.modules += ( "mod_proxy_core", "mod_proxy_backend_fastcgi" ) 增加php的fastcgi配置 $HTTP["url"] =~ "\.php$" { proxy-core.balancer = "round-robin" proxy-core.allow-x-sendfile = "enable" proxy-core.check-local = "enable" proxy-core.protocol = "fastcgi" proxy-core.backends = ( "unix:/tmp/php-fastcgi.sock" ) proxy-core.max-pool-size = 16 }

4. 启动fast-cgi进程 lighttpd 1.4中可以自动拉起fast-cgi进程,但1.5版本中改成了spawnfcgi方式,需要单独拉起。使用如下命令: # /usr/local/light/bin/spawn-fcgi -s /tmp/php-fastcgi.sock -f /usr/local/light/bin/php-cgi -u lighttpd -g lighttpd -C 5 -P /var/run/spawn-fcgi.pid

注: 要保证/tmp/php-fastcgi.sock文件是lighttpd 可读写的

  1. 启动lighttpd /usr/local/light/sbin/lighttpd -f /usr/local/light/etc/lighttpd.conf

注: proxy-core.check-local = “enable” 配置会导致下面错误,注释掉就没问题了。 2009-06-08 15:39:46 (error) (configfile-glue.c:169) found deprecated key in 'proxy-core.check-local' = 'use $PHYSICAL["existing-path"] =~ ... { ... } instead' 2009-06-08 15:39:46 (server.c:1507) Configuration contains deprecated keys. Going down.


Simon Lee

My blog