Django and nginx

Using Django 1.0 and above with nginx requires care when setting up the FCGI parameters. If SCRIPT_NAME ('') and PATH_INFO ($uri) are not properly set, URLs will not work properly.

Below is an example, which redirects requests to a Django socket.

    location /
        fastcgi_read_timeout  5m;
        include fastcgi_params;

        fastcgi_param   SCRIPT_NAME       '';
        fastcgi_param   PATH_INFO         $uri;

        if (!-f $request_filename) {
            fastcgi_pass  unix:/var/www/website/socket;


problem with URLs on FastCGI after update to 1.0


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s