Apache + mod_wsgi vs nginx + gunicorn

SamAko picture SamAko · Aug 5, 2013 · Viewed 19.3k times · Source

I want to deploy a django site (it is the open source edx code on github).

I am faced with choosing between using

  1. Apache with mod_wsgi
  2. nginx with gunicorn

I have used Apache with mod_wsgi and it's cool enough, but i have no experience with the second option.

Which of these would be a better option in terms of speed and also to some extent, ease of use?

NB: I would need to run two different django sites on say, port 80 and 81 and access them from two different subdomains.

Answer

Pranjal Mittal picture Pranjal Mittal · Dec 11, 2013

Nginx is a really light and easy to use solution and along with gunicorn it allows us to run any wsgi application and scale it easily. Nginx is better at handling requests since it does not spawn a new process for every request unlike Apache.

I have written an answer on how to deploy django with nginx for a related question:

Deploying Django project with Gunicorn and nginx