作者:tonyvicky
来自:LinuxSir.Org摘要:lighttpd是一个轻量级的WEB服务器软件,支持CGI FASTCGI等本文重点介绍lighttpd的CGI和FASTCGI模块的使用;目录
一、关于测试环境二、下载相关软件三、安装和配置1、安装lighttpd2、配置lighttpd3、设置CGI4、设置FASTCGI5、压力测试四、关于本文+-------------------------------------------+
| 正文 |+-------------------------------------------+一、关于测试环境
Ubuntu 5.10 , gcc4.0.2 , php5.1.1 , lighttpd 1.4.10如果要测试FASTCGI在编译PHP时需要打开fastcgi的选项( --enable-fastcgi)二、下载相关软件
lighttpd http://www.lighttpd.net/download/php http://www.php.net三、安装和配置
1、安装lighttpdroot@tonyvicky:# tar vxzf lighttpd-1.4.10.tar.gzroot@tonyvicky:# cd lighttpd-1.4.10root@tonyvicky:# ./configure --prefix=/usr/local/lighttpdroot@tonyvicky:# makeroot@tonyvicky:# make installroot@tonyvicky:# mkdir /usr/local/lighttpd/htdocsroot@tonyvicky:# mkdir /usr/local/lighttpd/etcroot@tonyvicky:# cp ./doc/lighttpd.conf /usr/local/lighttpd/etc/
2、配置lighttpd
然后修改配置文件 /usr/local/lighttpd/etc/lighttpd.conf把"mod_fastcgi"前边的#去掉(在24行);把"mod_cgi"前边的#去掉(在29行)设置网站根目录 server.document-root = "/usr/local/lighttpd/htdocs/" (40行)设置错误日志文件路径 server.errorlog = "/usr/local/lighttpd/lighttpd.error.log" (43行)设置访问日志文件路径 accesslog.filename = "/usr/local/lighttpd/access.log" (116行)启动服务器root@tonyvicky:# cd /usr/local/lighttpd/sbin/root@tonyvicky:# ./lighttpd -f ../etc/lighttpd.conf
$HTTP["url"] =~ "\.pdf$" { server.range-requests = "disable"}
cgi.assign = ( ".sh" => "" )
#!/bin/bashecho "Content-Type: text/html";echo "";echo "test";
root@tonyvicky:# chmod a+x test.sh
4、配置fastcgi
修改配置文件查找"#### fastcgi module"在这行之后添加fastcgi.server = ( ".php" =>(( "socket" => "/tmp/php.socket","bin-path" => "/usr/local/php/bin/php","min-procs" => 1,"max-procs" => 32,"max-load-per-proc" => 4,"idle-timeout" => 20)))
<?// test.phpphpinfo();?>
5、压力测试
四、关于本文