lighttpd

lighttpd

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,MacOSX)
● SGIIRIX
● Windows(Cygwin)
While it is known to compile cleanly on
● Solaris
● AIX
● Android

安裝過程


1. 下載最新版本
2. 解壓、安裝、配置
shell> tar zxvf lighttpd-1.4.12.tar.gz
shell> cd lighttpd-1.4.12
shell> ./configure –prefix=/usr/local/lighttpd
shell> ./make
shell> ./make install
shell> cp doc/rc.lighttpd.redhat /etc/rc.d/init.d/lighttpd
shell> cp doc/sysconfig.lighttpd /etc/sysconfig/lighttpd
shell> mkdir /etc/lighttpd
shell> cp doc/lighttpd.conf /etc/lighttpd/lighttpd.conf
shell> chkconfig lighttpd on
接下來打開/etc/rc.d/init.d/lighttpd修改lighttpd的值如下
lighttpd=”/usr/local/lighttpd/sbin/lighttpd”
打開/etc/lighttpd/lighttpd.conf修改服務的埠,以及文檔根目錄的路徑后啟動lighttpd服務
shell> 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