Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have nginx running on a VM and I want to run a Trac site. I need to run a python FastCGI server, but I cannot tell which is the server to use. I have found the following:

  • Lighttpd spawn-fcgi But this seems to require that you compile lighttpd just to get the fcgi server, which is weird.
  • But this one seems to be deprecated. At the very least it is poorly documented.
  • flup This one comes with dependencies on ubuntu (python-cheetah{a} python-mysqldb{a} python-webpy{a}) that seem unnecessary. Also poorly documented.

Are there any recent guides for setting this up? Trac's own FastCGI setup page seems to miss some steps.

share|improve this question

trac should be now WSGI compliant, so you can use any supported method to run the site. If it is a low traffic site, you can always use CGI, and eventually move to something else later if you need it. For the other methods, use mod_wsgi or install flup for FCGI (even if it installed extra dependencies).

To use flup, you have to import the appropriate WSGI server, then run it, i.e.

from flup.server.fcgi_fork import WSGIServer
def main_app(...):


If you want to run it as external server (i.e. not started by the web server), substitute this:

share|improve this answer
See above regarding mod_wsgi (unmaintained, webserver running multiple different scripting engines). I cannot find any documentation on how to setup flup, do you have any guides. As far as I can tell, Nginx doesn't just run CGI, it needs a (Fast)CGI server to run the scripts. – Rob Apr 6 '10 at 18:18
Added to the answer for formatting. – Dan Andreatta Apr 6 '10 at 19:27
Rob. I think you will find from most people the suggestion is to use Apache/mod_wsgi more so than nginx/mod_wsgi. The Apache/mod_wsgi is definitely not 'unmaintained' and has copious amounts of documentation to go with it as well. – Graham Dumpleton Apr 6 '10 at 23:58

Well man, flup is used by Django itself. Its an awesome method to run python fastcgi applications unless you have a mod_wsgi or something similar.

The code to run flup is:

from flup.server.fcgi import WSGIServer

def app(environ, start_response):
  start_respone('200 OK', [('Content-Type', 'text/plain')])
  yield "Hello World"

share|improve this answer
And yeah, I don't think flup has any dependencies, I installed it recently without any. I'm on Arch Linux. – Nilesh Aug 10 '10 at 13:24

Why FastCGI in particular? In Python, there's a standard interface for writing web server apps, called WSGI. Various servers provide frameworks for doing this; eg, mod_wsgi for Apache. For nginx, there appears to be: which is even based on mod_wsgi.

share|improve this answer
The nginx/mod_wsgi can't really be said to be based on Apache/mod_wsgi. The author of nginx/mod_wsgi looked at Apache/mod_wsgi, used similar concepts and configuration naming for parts, but because the internals of nginx are quite different to Apache, the code is pretty well all new. Just be careful about what you use nginx/mod_wsgi for as the use of an underyling event based web server raises problems in multi process configurations where you have a blocking WSGI on top. Read '…;. – Graham Dumpleton Apr 6 '10 at 9:30
@Phil: WSGI is a common interface for all methods for dynamic content, be it CGI, FCGI, SCGI or an apache module (mod_wsgi, which replace mod_python). In fact flup provides a WSGI server, with FCGI connection mechanism. – Dan Andreatta Apr 6 '10 at 9:55
@Phil, it doesn't seem that this module has been actively developed in quiet awhile. I am running a web server with PHP, Python & Perl scripts. To me it makes more sense to use FastCGI instead of modules given my low memory VM setup. – Rob Apr 6 '10 at 18:14
@Dan my issue with flup is that it is completely undocumented. I do not know what flup is nor how to use it. Relying on undocumented hobby software scares me. Tomorrow the guy could take his code down and replace it with LOLCats. – Rob Apr 6 '10 at 18:15
@Graham: per the URL I gave, the design was influenced by, and it borrows code from, mod_wsgi. I guess "based on" was too strong a statement. Sorry. @Dan-Andreatta: I know how they relate; it's just that FastCGI seemed to be an overly strong requirements statement, given the presented problem, and designing to work with WSGI is, IMO, the way to go. @Rob: okay, the existing use of FastCGI for other languages is sufficient cause to stick to a common platform. :) – Phil P Apr 7 '10 at 3:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.