Lighttpd 轻量级服务端

来源:互联网 发布:java开发实战经典ppt 编辑:程序博客网 时间:2024/06/05 23:47

前言

在lighttpd.net的官网上这样介绍这款服务器软件:

Security, speed, compliance, and flexibility -- all of these describe lighttpd (pron. lighty) which is rapidly redefining efficiency of a webserver; as it is designed and optimized for high performance environments. With a small memory footprint compared to other web-servers, effective management of the cpu-load, and advanced feature set (FastCGI, SCGI, Auth, Output-Compression, URL-Rewriting and many more) lighttpd is the perfect solution for every server that is suffering load problems. And best of all it's Open Source licensed under the revised BSD license.

我的理解如下:

  • lighttpd是一款完整的服务器软件,符合服务器的统一标准,包含了apache中的Cgi/Fcgi,Rewrite,Access等组建。
  • lighttpd突出了轻量级,内存占用非常之少,可以节省下来大量内存给应用和磁盘缓存。此外单进程减少很多不必要的 context switch , 在慢网并发连接时候非常明显了。
  • lighttpd是一款BSD的开源软件
在这个地方有lighttpd,apache,nginx三款软件的比较:http://down.chinaz.com/server/201111/1366_1.htm

本来是学习CGI,需要服务器软件,以前都是用apache,感觉它很大,所以就选择这款比较小的服务器作为服务器学习的开端。这篇文章会有各种学习过程的记录。仅供个人记录,勿喷!

让lighttpd支持CGI

通过修改lighttpd的配置文件lighttpd.conf使其支持CGI。
(1)使用语句 server.modules = ("mod_cgi") 加入 cgi 模块;
(2)使用语句 cgi.assign = (".cgi" => "") 设置 cgi 模块的扩展名和解释器。就本语句而言,表示cgi模块的扩展名是“.cgi”且该 cgi 模块不需要特别的解释器来执行。
server.document-root = "/home/gss/workspace_c/web/"server.port = 3000server.modules = ("mod_cgi")cgi.assign = (".cgi"=>"")