Nginx and uwsgi

Roberto De Ioris roberto at
Mon Jun 11 18:15:25 UTC 2012

> Hi Roberto,
> Thanks for the prompt response. That really helps.
> Our major consideration for going with Nginx is performance.
> If we have another process running (a wsgi server with python application)
> and nginx working as a proxy translating HTTP requests to another protocol
> (uwsgi, http or fastcgi), won't that be an overhead?

Yes, there is an overhead, but it is practically irrelevant in the big
scheme. Your bootleneck will hardly be the webserver or the application
server. Running custom/non-deterministic apps directly in the webserver is
a really old-style approach and afaik, only the php world still pushes
this kind of setups.

Take in account (as you came from apache), mod_wsgi preferred setup is in
daemon mode, that is a beatiful abstraction of a proxied setup.

> I was under the impression that the Python application can be embedded in
> Nginx using Wsgi.

the only third-party-module allowing you to do so, is Manlio Perillo's
mod_wsgi/mod_python for nginx. It is unmaintained, and its preferred usage
is in having another nginx in front of it proxying requests. Nginx is a
non-blocking server, putting blocking code in it (as 90% of the webapps
are), is the key to hell :)

If you have got experience with apache+mod_wsgi, you can simply use nginx
for serving static files and using apache+mod_wsgi (in embedded mode) as
your application server for python/wsgi. This is now a very common setup.

Roberto De Ioris

More information about the nginx mailing list