0

We are keen to use nginx + uwsgi for django based application , as we want to try newer solutions, and have heard good about nginx being less resource intensive than apache.

After reading some views from one of Django's creator about apache on Quora :

http://www.quora.com/What-web-server-suits-Django-best

I'm still a big fan of a stripped down Apache+mod_wsgi running behind nginx.    
Nginx handles static files, gzip, trickling to slow clients, load balancing and 
having  a configuration language that's actually pleasant to work with.    
Apache just sits there serving up dynamic Python pages via mod_wsgi, using the 
shortest  possible config.The reason I like Apache for this is I don't need to
babysit the process at all, unlike if I was using FastCGI or running a separate
Python app server.

I do not intend to setup 2 web servers for different purposes, would be more happy to have nginx alone doing all the work along with uwsgi for django. I have few questions :

  • What is meant by "No need to babysit the process at all" ? Does nginx+uwsgi need some extra effort as compared to apache+mod_wsgi ?

  • Nginx is said to have inbuilt support for uwsgi , and not for gunicorn, what does that mean ?

DhruvPathak
  • 141
  • 4

1 Answers1

1

The "babysitting" part, is about manually starting uWSGI/gunicorn processes (via tools like supervisor, monit or simple rc scripts).

More than a year ago uWSGI solved that "issue" with the uWSGI Emperor, that will babysit instances for you in a very easy way (just drop config files in a dir). So one setup requires a startup script for nginx and one for apache, while the other requires one for nginx and one for the uWSGI Emperor (so we are 2:2).

Regarding uwsgi support in nginx, it is related to the 'uwsgi protocol', not the uWSGI application server. It is a more simple transport than http, so it can bring some performance benefit and add some specific feature (like directly passing WSGI vars). You are not forced to use the uwsgi protocol, you can simply start uWSGI in http mode (as gunicorn) and normally proxy it.

Having said that, take in account that current uWSGI python-codebase is very similar to the mod_wsgi one (the mod_wsgi author helped a lot fixing uWSGI python bugs), so if you do not need specific uWSGI features, you will not gain particular advantages over a really stripped-down apache+mod_wsgi.

roberto
  • 1,812
  • 12
  • 8
  • Thanks Roberto to clear my doubts, particular advantage I was looking for was to not having to run 2 webservers nginx and Apache, nginx alone will handle wsgi,static content etc. – DhruvPathak Aug 03 '12 at 06:59