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 am running a web-service on Nginx/FastCGI/Django. Our processing time is fairly long and CPU intensive and I would like to be able to run multiple processes of Django/FastCGI to share the load. How do I set Nginx to rout requests from a single source to multiple instances of Django/FastCGI? (I can run the multiple instances on multiple ports/sockets, but I don't know how to make Nginx share the processing load between them.)

Any help much appreciated.

share|improve this question

Works with both proxy_pass and fastcgi_pass.

share|improve this answer

I realize the question is for fastcgi, but the easiest and speediest way to spawn and load balance a cluster of Python web applications with nginx is to NOT use fastcgi module, but to use the "uWSGI" module. Example nginx config:

upstream uwsgicluster {

server {
    listen   80;
    access_log /srv/www/;
    error_log /srv/www/;

    location / {
        include        uwsgi_params;
        uwsgi_pass     uwsgicluster;

    location /static {
        root   /srv/www/;
        index  index.html index.htm;

uWSGI website is here and be sure to look at the Examples page including Django here:

share|improve this answer

According to the official website, you can spawn the fcgi with the parameter :

cd {project_location}

python ./ runfcgi --settings={project}.settings_production maxchildren=10 \

maxspare=5 minspare=2 method=prefork socket={project_location}/log/django.sock pidfile={project_location}/log/

Or maybe in the same way as the php-fcgi works in its conf script, where I have (in /etc/init.d/php-fcgi) :


share|improve this answer

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.