nginx vs lighttpd

sponsored links
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.
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of nginx vs lighttpd

  • Spaces sliceHost rails host ror

    Register sliceHost buy virtual host. https: / / / customers / new? referrer = 951c40e184743beeb90436bb96ad9aba Use slicehost. One reason is very simple, freely ~ other providers compared to a virtual host, with root permissions, ...

  • Procedures for the performance of watercress

    Units one Web server running Lighttpd, every day 25 million deal with request, peak per second handle 1000 request; Units one application server to run Python, every day five million deal with PV; Database server running MySQL, load conditions there ...

  • nginx 502 Bad Gateway error collection problem

    Since, nginx and lighttpd documentation rarely true, not to mention the Chinese documents, and so the collection of some of the mistakes on the 502 here, to retain the source address, source address of the proposed look of the content. 502 are FastCG ...

  • Capistrano automatic deployment of Rails projects (Windows to Bluehost Fastdomain)

    Prerequisites: 1. Install SVN client 2. Install TortoiseSVN 3. Install SSH Start: 1. Install Capistrano (latest version for 2.5.X) 2. Go to your rails app on a layer of the directory, to generate support for Capistrano rails_name for your rails app&# ...

  • Robbin on the PHP / Ruby some concluding

    Robbin forward to the PHP forum on some conclusion, it is not picky:) collection of Quote PHP and Python / Ruby operating mechanism has an essential difference between: PHP are each HTTP request coming after the initialization of all resources (such ...

  • To talk about Ruby variables

    School at the time heard that dynamic languages, python La. , ruby, lua you are. Get a picture of the object can change the runtime state, such as to add property to increase the Ways La. . But dynamic languages has been in the end do not know how to ...

  • For the past two days, ruby development web site performance test summary

    This is only the individual test, is also a ruby beginner test, if ill-Optimize and causing significant error also invited Members to make the exhibitions. Rails vs Rack vs Merb: Merb worse performance than Rails, but documents, rich plug-ins, plus Rack c

  • [Portal] with Ruby call ICE interface

    Ice is not introduced, Ruby is not introduced. I try ah, the steps I will be clearly recorded, One to definitely not let the people Society, Second, I am afraid I have forgotten the past two days, brain hypoxia, only three days to re

  • flash chart summary

    pen Flash Chart is an open source Flash chart drawing tool, offers a variety of programming interfaces, including PHP, Ruby, Perl, Python, Java,. Net, AS, JS, etc. to generate a variety of data interfaces, and then Flash to display the function is to ...

blog comments powered by Disqus
Recent Entries
Tag Cloud
Random Entries