Lighttpd 是一个德国人领导的开源Web服务器软件,其根本的目的是提供一个专门针对高性能网站,安全、快速、兼容性好并且灵活的web server环境。具有非常低的内存开销、cpu占用率低、效能好以及丰富的模块等特点。

简介

Lighttpd是众多OpenSource轻量级的web server中较为优秀的一个。支持FastCGI,CGI,Auth,输出压缩(output compress),URL重写,Alias等重要功能;而apache之所以流行,很大程度也是因为功能丰富,在lighttpd上很多功能都有相应的实现了,这点对于apache的用户是非常重要的,因为迁移到lighttpd就必须面对这些问题。

操作系统

Releases of lighttpd are built regulary for at least the following platforms

Linux(binary packages for FC3,SuSE,Debian,Gentoo,PLD-Linux,OpenWRT,Ubuntu)

● *BSD(FreeBSD,NetBSD,OpenBSD,Mac OS)

● SGIIRIX

● Windows(Cygwin)

While it is known to compile Cleanly on

● Solaris

IBM AIX

Android

安装过程

1. 下载最新版本

2. 解压、安装、配置

shell\u003e tar zxvf lighttpd-1.4.12.tar.gz

shell\u003e cd lighttpd-1.4.12

shell\u003e ./configure –prefix=/usr/local/lighttpd

壳层\u003e ./make

shell\u003e ./make install

shell\u003e cp doc/rc.lighttpd.Red Hat /etc/rc.d/init.d/lighttpd

shell\u003e cp doc/sysconfig.lighttpd /etc/sysconfig/lighttpd

shell\u003e mkdir /etc/lighttpd

shell\u003e cp doc/lighttpd.conf /etc/lighttpd/lighttpd.conf

shell\u003e chkconfig lighttpd on

接下来打开/etc/rc.d/init.d/lighttpd修改lighttpd的值如下

lighttpd=”/usr/local/lighttpd/sbin/lighttpd”

打开/etc/lighttpd/lighttpd.conf修改服务的端口,以及文档根目录的路径后启动lighttpd服务

shell\u003e service lighttpd start

更多关于lighttpd的配置请看lighttpd的文档

附注在lighttpd中可以通过下面的配置来实现每天一个访问日志文件:

accesslog.filename = “| /usr/local/lighttpd/bin/rotatelogs /usr/local/lighttpd/logs/access_%Y%m%d.log 86400″

其中rotatelogs直接从apache的bin目录拷贝过来即可。

配置日志记录格式:

accesslog.format = "%h %l %u %t "%r" 200 %b "%{Referer}i" "%{User-Agent}i""

高级特性

虚拟主机

virtual directory listingsURL-Rewriting,HTTP-Redirects,FLV-streaming

automatic expiration offiles

大文件支持(64bit file offsets)

断点续传(start-end,start-,-end,multipleranges)

压缩输出(支持deflate,gzip,bzip2)

认证方法

basic,digest

backends:plainfiles,htpasswd,htdigest,ldap

fastand secure application controlled downloads

Server Side Includes

User Tracking

FastCGI,CGI,SSI

SSL

PHP支持

通过FastCGI和CGI接口实现

支持PHP代码缓存,例如XCache,APC或eAccelarator

FastCGI负载均衡(one webserver distibutes request to multiple PHP-serversviaFastCGI)

在配置文件后面加入:

安全特性

chroot(),setUID,setGID

protecting doc root

strict HTTP-header parsing

参考资料