nginx vs lighttpd

I have been using Lighttpd for almost a year and Nginx for a month on my servers. I know that they were created to be massively scalable, solving the C10k problem . However their asynchronised-IO model and small memory foot-print also make them suitable as alternative HTTP servers for memory-limited VPS. Alternative = Anything but the current defacto Apache .

I will be writing more about Lighttpd and Nginx later during the year, but will try to use this post to draw some comparison between Nginx , The new darling of these light-weight web servers, and Lighttpd , Many Web 2.0 developers' all time favourite.


nginx vs lighttpd
I have been running Lighttpd (pronounced "lighty") on my home servers and development boxes since the beginning of 2006. It is a great replacement for Apache if you have the whole box to yourself, ie you don't need to worry about supporting .htaccess files that your users might use. Currently this website is hosted on lighttpd-1.4.13 on a Gentoo VPS.


  • Light weight. Clean restart of 1.4.13 takes no more than 2Mb RSS on this 64bit VPS. It binds the port, drops the privilege and that's it! A single process does all the tricks even when you have hundreds of concurrent connections. No more pre-fork MPM with mis-configured MaxClient that sends you to swap hell.
  • Speed. Very fast static file serving. Very fast FastCGI serving. Very fast proxy serving.
  • Modules, and lots of them . Good comprehensive documentation as well. It even has SCGI for your Quixote apps.
  • Mod_magnet. Wanna a scripting engine right inside your web server? Mod_magnet integrates Lua into lighttpd, so your World of Warcraft scripting skillz can be put into better use.
  • Community. It has got a Blog , A Wiki / bug tracker and a forum . It is easy to find help when you need one.


  • Stability (or lack of according to the RoR folks). I had quite a lot of issues using Lighttpd as proxy + HTTPS front-end for our Python stuff, but the same app runs fine with just lighttpd + proxy without HTTPS.
  • Mod_rewrite (or again, lack of it). Built-in rewriting engine sucks, and porting Apache mod_rewrite rules over can be non-trivial sometimes. Update: Here's an article I have written on Drupal clean URL on Nginx and Lighttpd , Which looks at the URL rewrite options of these two web servers.
  • Memory leak. The RSS of my lighty process grows by about 1.5Mb per day, but then I don't have lots of traffic (less than 50k requests a day). At the end I just need to restart it once a week. Many people have far worse memory leaking issues I heard.


I have been running Nginx (pronounced "engine X") on my development box and two of my VPS's since December 2006. It is Russian, fast and very configurable. I am currently using 0.5.5 for my sites, but don ' t be deceived by its version number - it is very stable.


  • Light weight. It is not as light weight as lighttpd when it clean-starts. At least two processes are needed - one master process running as root that binds to the port, and one or more worker processes that handle the actual requests. Around 7Mb RSS together on my 64bit VPS (and only 4.5Mb on 32bit VPS). Still beats Apache hands down.
  • Fast. Some benchmarks have shown that Nginx has a slight edge over Lighttpd, but so far I haven't been able to notice any. Again, much faster than Apache over static file serving or proxying, especially when you turn up the value of keep alive (more than 1 minute for example).
  • Modules. There are many modules available on Nginx. Some very useful, and some are just plain weird. While lighttpd has Lua embedded, you can now also embed the whole Perl interpretor inside Nginx.
  • Better Rewrite Module. A much better rewrite module than Lighttpd that supports complex conditions. Porting mod_rewrite rules from Apache is actually now feasible without touching the apps themselves.
  • Stable and not leaking. Been running Nginx on a production site doing PHP-FastCGI, and have no issue what so ever.


  • Lack of community. Where can I find help regarding Nginx? There's only IRC as far as I know. And while the lead developer writes beautiful code, all documentation were initially in Russian which was a big stumbling block before the English docs came along.
  • No CGI support. Oh well, maybe I am the only one who still hacks small CGI scripts. Apparently Nginx does not spawn CGI or FastCGI processes, which means you need to either (1) convert it into external-spawn FastCGI, or (2 ) proxy to another web server that does CGI.
  • No simple virtual host support. Lighttpd has mod_simple_vhost and mod_evhost to let you quickly deploy lots of name-based virtual hosts. You can somehow do the same with using $server_name in root and a wild-card in server_name, but it's still not as clean as lighttpd. At the end you will find Nginx configuration files much more verbose if you run lots of small sites off a single web server.
  • No X-sendfile support. I found Lighttpd's X-sendfile support very useful when my scripts need to send back large files, and was disappointed to find out that Nginx does not have it. X-Accel-Redirect is different as it requires extra configuration on web server, which makes your web-app less portable.


I don't think I am a suitable judge to say which one is better, as (1) I have only been running Nginx for a month, and (2) my level of traffic does not really stress test these high-performing web servers . At the moment I think I like Nginx better purely because it does not leak, and its rewrite module that enables me to run many off-the-shelf open source PHP apps with clean URL.

Again, I might change my mind in 3 months time when I find out more warts about Nginx. We will see.

分类:Ruby 时间:2009-03-15 人气:2771
blog comments powered by Disqus


  • nginx see the number of concurrent connections 2010-05-25

    Concurrent connections by looking Nginx, we can be more clear to know the site load. Nginx complicated view there are two ways (This is so because I only know of two), one is through the web interface is through the command, web view than the command

  • Nginx limit the number of concurrent ip 2010-12-24

    Nginx limit the number of concurrent ip, that is the same ip limit the number of simultaneous connections the server. 1, add limit_zone This variable can only use http. vi / usr / local / nginx / conf / nginx.conf limit_zone one $ remote_addr 10m; 2,

  • Legend with only 15 lines Python statement P2P client / server [change] 2010-04-16

    #zz from # 1.0 (documentation at # (C) 2004, E.W. Felten # license: # Annotated by Kochin Chan

  • How to view the Linux system apache concurrent connections 2011-08-12

    How to view the Linux system apache concurrent connections View that the number of httpd processes (ie, prefork mode Apache can handle concurrent requests): Linux shell command as follows: ps-ef | grep httpd | wc-l Check the Apache number of concurre

  • Lucene concurrent connections to achieve - ConcurrentLuceneConnection 2011-10-14

    Lucene concurrent connections to achieve code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71

  • python检测lvs real server状态 2013-11-10

    这篇文章主要介绍了用python检测lvs real server状态的示例,大家参考使用吧 import httplib import os import time def check_http(i): try: conn=httplib.HTTPConnection(i, 80, timeout=2) conn.request("GET","/") response = conn.getresponse() except Exception as e: prin

  • Tomcat Server.xml contents of the file 2010-09-12

    1 Server 1.1 In the Tomcat world, a Server represents the whole container. Tomcat provides a default implementation of the Server Interface. , and this is rarely Customized by users. 1.2 in tomcat's world, a server on behalf of the entire container.

  • Web servers and application servers the difference between 2008-10-18

    Popular speaking, Web server, send (serves) Page so that browsers can view, however, the application server provides the client application can call (call) Way (methods). The point, You can say :Web Server dedicated to handling HTTP requests (request

  • Web Servers and Workflow 2013-07-24

    Working with a large site, with lots of people and pages maintaining it, you will come across various workflows to get from a web design paper prototype to the actual pages live on the internet. The workflow for a complex site can include many separa

  • MySQL he server quit without updating PID file解决办法 2015-04-12

    1 问题 [root@localhost mysql]# /etc/rc.d/init.d/mysql status MySQL is not running, but lock file (/var/lock/subsys/mysql[FAILED] [root@localhost mysql]# /etc/rc.d/init.d/mysql start Starting MySQL...The server quit without updating PID file (/usr/local

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C), All Rights Reserved. 版权所有 闽ICP备15018612号

processed in 0.234 (s). 12 q(s)