Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Which of Lighttpd and Nginx is, basing on your experience, better suited for Django? I've used both and can hardly notice any difference at all, they just work fine... Are there any use cases when one of them acts much better than the other? When answering please take in account both simplicity of configuration and efficiency.

My usual setup is to have a separate Django FCGI process (like in ./manage.py runfcgi daemonize=false port=8098 host=127.0.0.1) launched via daemontools or an init.d script and lighty/nginx acting as a reverse proxy.

Oh, and if you feel some other http server is much better for Django than Lighty and Nginx, please don't hesitate to share your thoughts.

share|improve this question
    
If a fastcgi service dies, daemontools supervise will restart it within five seconds, so the service is back up. But you still have a tiny lag of downtime there. In my deployment I found fastcgi to be fragile stopping unexpectedly under mild pressure. After a few downtimes and couple awkward phone calls from clients, I switched Nginx to reverse proxy to Apache mod_wsgi and everything is just humming ever since. –  user64550 Dec 23 '10 at 16:07
add comment

4 Answers

mod_wsgi is recommended way to get Django application into production. Apache's mod_wsgi is much better than nginx. You can't find official package (in current Linux distributions) for nginx's mod_wsgi and You need to compile it by yourself. I like nginx but if You want to play safe, play with Apache mod_wsgi.

share|improve this answer
1  
Nginx mod_wsgi is not something you'd want to use. Nginx is best to serve static content and reverse proxy to Apache mod_wsgi to generate the dynamic. You wouldn't want to use asynchronous web server for both generating dynamic pages and serving static content. Apache mod_wsgi on it's own does not make much sense either. You woun't want that beast to be busy spraying around static files, while it is supposed to do the heavy lifting. Read more here b-list.org/weblog/2008/jun/23/media –  user64550 Dec 23 '10 at 15:57
add comment

Also, consider using Google App Engine. You can host your Django project there for free and not have to worry about maintaining the server infrastructure.

share|improve this answer
8  
Django on GAE has significant limitations, like not supporting any of Django's datbase/ORM features. If it supports what you need, great - but check carefully! –  Kevin May 27 '09 at 13:33
    
I believe MySQL is now supported by GAE so I presume ORM will be as well. Though is true I has no experience trying it out. Django without ORM is like porn without torrents. –  Vangel Jan 25 '12 at 16:54
add comment

Both Nginx and Lighttpd are better choices than apache when it comes to using them as a reverse proxy for Django, Rails, etc. Both support FastCGI and Http proxying. Both offer a single threaded select() (or better) based model for efficient resource usage.

However my vote goes to Nginx, it's got a very active user base (it's currently the darling of the Ruby on Rails set), and is under active development. Lighttpd could be mistaken for being dead, 2+ years and we're still waiting on a beta of 1.5.

share|improve this answer
add comment

mod-wsgi is the best way to run django apps in production, less fiddly than fastcgi and no issues with start up times etc.

The real mod-wsgi is for apache, but there is another mod-wsgi for nginx. The apache one is brilliant, I can't comment on the nginx one.

Personally, I'd stay away from lighttpd. It doesn't have the stability of nginx, I've not yet seen a case of lighttpd that doesn't have a memory leak.

Basically, my first choice would be apache 2.2, my second choice would be nginx.

Don't believe the hype about response time and scalability. Truth is, it just doesn't matter. (Google use Apache).

share|improve this answer
    
Google use GWS (en.wikipedia.org/wiki/Google_Web_Server) not Apache. Yahoo use Apache, but it's an ancient fork of 1.3. –  Dave Cheney May 27 '09 at 13:18
    
YouTube uses or at least used lighttpd, so I don't think that it's so bad. See highscalability.com/youtube-architecture. –  Cristian Ciupitu May 27 '09 at 15:33
    
Yes, but while GWS is a secret project, it is known it be based on Apache. –  Rich May 30 '09 at 2:20
    
what YT is not saying is that they have their own fork of lighty. Is true lighty has a well known memory leak problem. I believe they may have fixed it by now, but the rep persists. –  Vangel Jan 25 '12 at 16:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.