Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 a simple Django application that I am using to test out a new deployment strategy using Nginx, FastCGI (using the latest version of flup at the time of writing) and daemontools.

Basically the problem is if I visit the main page displays correctly but if I visit it still displays the main page. This seems like a problem with FastCGI to me but I'm completely stumped. No matter what page I visit it always displays the main page. No errors, nothing. Its like it always just silently returns the same page no matter what the url.

The nginx error log has absolutely nothing displayed in it at all so that is no help. The project works 100% perfectly using the development server but just fails on the server.

My daemontools run file is as follows:

#!/usr/bin/env bash

source /envs/

exec envuidgid simon python $PROJ_DIR/ \
        runfcgi method=threaded minspare=1 maxspare=2 host= \
        port=9001 pidfile=$PROJ_DIR/ daemonize=false

My nginx config:

server {
    listen 80;
    rewrite ^/(.*)$1 permanent;

server {
    listen 80;

    access_log /;
    error_log /;

    root /;
    index index.html;

    location / {
        try_files $uri @django;

    location /static {
        alias /project/static;

    location /media {
        alias /project/media;

    location @django {
        include /opt/nginx/conf/fastcgi_params;
        fastcgi_pass_header Authorization;
        fastcgi_intercept_errors off;

Any help would be very much appreciated :).

share|improve this question
up vote 2 down vote accepted

What do you have in fastcgi_params? You should have something like:

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

fastcgi_param  PATH_INFO          $fastcgi_script_name;

Also set in


This is one way to do it. You can also leave FORCE_SCRIPT_NAME on the default and configure everything through nginx.

share|improve this answer
Thank you! If anyone else is having these issues the magic was in setting FORCE_SCRIPT_NAME = '' in and adding fastcgi_param PATH_INFO $fastcgi_script_name; to fastcgi_params. – Cromulent Mar 12 '11 at 14:38

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.