Nginx – the purpose of running nginx infront of your app servers on Amazon EC2

amazon-web-servicesgunicornnginx

I've been doing a lot of research into back-end architecture. I'm currently running a django app server and a postgresql database server on Amazon's Web Services. All of my content is served through Gunicorn. I would like to know why nginx servers are place in front of the the django app servers. What is their purpose? Here is a diagram:

https://d36cz9buwru1tt.cloudfront.net/architecture_diagram_praekelt-1.jpg

Best Answer

In many stacks, nginx is often placed in front of unicorn or gunicorn for buffering responses to slow clients.

See the nginx documentation for more information:

http://wiki.nginx.org/HttpProxyModule#proxy_buffering

The ELB doesn't do buffering, so having nginx in place can save your bacon.

Related Topic