<divstyle="padding: 0 0 20px 0; margin: 0 0 20px 0; background-color: #22B24C;">
<divclass="container">
<pclass="banner"><ahref="https://www.gumroad.com/l/python-deployments" style="color: #fff">Learning web development? Check out The Full Stack Python Guide to Deployments book</a>!</p>
</div>
</div><ahref="https://github.com/makaimc/fullstackpython.com"><imgstyle="position: absolute; top: 0; right: 0; border: 0;" src="/img/fork.png" alt="Fork me on GitHub"></a>
<ahref="http://w3techs.com/technologies/cross/web_server/ranking">second most common web server among the top 100,000 websites</a>. Nginx also functions well as a
reverse proxy to handle requests and pass back responses for Python
<ahref="/wsgi-servers.html">WSGI servers</a> or even other web servers such as Apache.</p>
<p><imgsrc="/img/web-servers-map.png" width="100%" alt="Python web application deployments rely on Nginx either as a web server or reverse proxy for WSGI servers." class="technical-diagram" /></p>
<divclass="well see-also">Nginx is an implementation of the <ahref="/web-servers.html">web server</a> concept. Learn how these pieces fit together in the <ahref="/deployment.html">deployment</a> chapter or view the <ahref="/table-of-contents.html">table of contents</a> for all topics.</div>
<h2>Should I use Nginx or the Apache HTTP Server?</h2>
<p>Let's be clear about these two "competing" servers: they are both fantastic
open source projects and either will serve your web application deployment
well. In fact, many of the top global web applications use both servers in
their deployments to function in many steps throughout the HTTP
request-response cycle.</p>
<p>I personally use Nginx more frequently than Apache because Nginx's
configuration feel easier to write, with less boilerplate than alternatives.</p>
<p>There's also a bit of laziness in the usage: Nginx works well, it never causes
that set up Nginx with HTTPS and SSL/TLS certificates </p>
<h2>Nginx resources</h2>
<ul>
<li>
<p>The <ahref="http://www.aosabook.org/en/nginx.html">Nginx chapter</a> in the
<ahref="http://www.aosabook.org/en/index.html">Architecture of Open Source Applications book</a>
has a great chapter devoted to why Nginx is built to scale a certain way
and lessons learned along the development journey.</p>
</li>
<li>
<p><ahref="http://nginx.com/blog/inside-nginx-how-we-designed-for-performance-scale/">Inside Nginx: How we designed for performance and scale</a>
is a blog post from the developers behind Nginx on why they believe their
architecture model is more performant and scalable than other approaches
used to build web servers.</p>
</li>
<li>
<p><ahref="http://articles.slicehost.com/nginx">Nginx web server tutorials</a> are oldies
but goodies on setting up previous versions of Nginx. </p>
</li>
<li>
<p><ahref="http://carrot.is/coding/nginx_introduction">Nginx for Developers: An Introduction</a></p>
</li>
<li>
<p>An example of an <ahref="http://tautt.com/best-nginx-configuration-for-security/">Nginx security configuration</a>.</p>
</li>
<li>
<p><ahref="http://arstechnica.com/business/2011/11/a-faster-web-server-ripping-out-apache-for-nginx/">A faster Web server: ripping out Apache for Nginx</a>
explains how Nginx can be used instead of Apache in some cases for
better performance.</p>
</li>
<li>
<p><ahref="https://www.nginx.com/blog/nginx-vs-apache-our-view/">Nginx vs Apache: Our view</a>
is a first-party perspective written by the developers behind Nginx
as to the differences between the web servers.</p>
</li>
<li>
<p><ahref="http://lincolnloop.com/blog/rate-limiting-nginx/">Rate Limiting with Nginx</a>
covers how to mitigate against brute force password guessing attempts using
Nginx rate limits.</p>
</li>
<li>
<p><ahref="http://tenzer.dk/nginx-with-dynamic-upstreams/">Nginx with dynamic upstreams</a>
is an important note for setting up your upstream WSGI server(s) if you're
using Nginx as a reverse proxy with hostnames that change.</p>
</li>
<li>
<p><ahref="https://serversforhackers.com/nginx-caching/">Nginx Caching</a> shows how
to set up Nginx for caching HTTP requests, which is often done by Varnish
but can also be handled by Nginx with the <code>proxy_cache</code> and related
directives.</p>
</li>
</ul>
<h3>Continue learning about web servers or move to a new topic?</h3>
<ahref="http://www.deploypython.com/"><imgsrc="/img/sponsored/fsp-deployment-guide.png" alt="The Full Stack Python Guide to Deployments" width="100%"></a>
<pstyle="font-size: .8em; margin-top: 10px;">Searching for a complete, step-by-step deployment walkthrough? Learn more about <ahref="http://www.deploypython.com/">The Full Stack Python Guide to Deployments book</a>.