2

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

2 Answers 2

1

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.

0

Generally you put a reverse proxy in front of backend servers like gunicorn (or tomcat in the java world) because they have more features and are more resilient.

E.g., with nginx you can add fine-grained access control, terminate SSL, and not be as susceptible to DOS attacks (which is what gunicorn specifically mentions in their docs ( http://docs.gunicorn.org/en/latest/deploy.html ).

In EC2 you could replace nginx and haproxy with an ELB if there are no special features of nginx or haproxy you are using. See http://harish11g.blogspot.com/2012/11/amazon-elb-vs-haproxy-ec2-analysis.html for a comparison of ELBs and haproxy.

1
  • I've look into back end setups of many other companies on AWS and some of them have the ELB in front and then NGINX behind them, why is that?
    – deadlock
    Commented Apr 16, 2013 at 18:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .