Many existing hints, often part of the documentation of popular Python web application-related projects, show simple, working nginx configuration but nothing equivalent for Apache httpd — sometimes nothing at all, sometimes something very crufty.
I'm not aware of any small number of sources that cover as many considerations, especially in a consistent manner.
Apache httpd 2.4.latest, nginx 1.6.latest
Why uWSGI? Besides being well respected, well documented, and well maintained:
unbit
has been
extremely responsive in resolving issues I've found while researching this
tutorial.(I have some coverage of alternatives to uWSGI, notably Gunicorn, starting here. See also A Comparison of Web Servers for Python Based Web Applications.)
Clearly I'm diverging from the historical means of running Python web apps with httpd — mod_wsgi, mod_fcgid, or other plug-ins that manage the application lifecycle in addition to routing requests to the applications. There are several reasons for this:
The baseline software versions used for this tutorial were httpd 2.4.10, nginx 1.6.0, and uWSGI 2.0.5. In the cases outlined below, you are likely to encounter problems or limitations with certain older versions of this software:
mod_proxy_fcgi crash if backend isn't listening (fixed in httpd 2.4.10)
mod_proxy_scgi: no support for Unix sockets (fixed in httpd 2.4.10)
issue with FastCGI protocol handling, resulting in intermittent request failures with httpd's mod_proxy_fcgi; could conceivably affect deployments with nginx, but I didn't encounter that
This fix was in uWSGI 2.0.5, released in June of 2014. If you installed uWSGI previously and you want to use FastCGI with httpd's mod_proxy_fcgi, upgrade first.
Some undiagnosed misbehavior is listed on the last page of this tutorial.