views:

52

answers:

0

To see an example: load up a example.com, click on a link that's linking to /test and instead of going to http:// example.com/test/ it goes to http:// www.example.net//test/

Or if you login, the login form for the auto-generated django admin section posts to //admin instead of admin.

Seems like this is a django issue, but the only thing I changed was nginx.

Couple of additional notes (added Oct 31):

Here is the nginx fastcgi_conf:

#fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  SCRIPT_FILENAME    $fastcgi_script_name;
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/$nginx_version;

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;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

Django project config

server {
        listen  80;
        server_name www.site.net;

        location / {
            fastcgi_pass unix:/path/to/site/server.sock;
            include     fastcgi.conf;
            access_log  /var/log/nginx_django.log  main;
        }

        location ^~ /admin/$ {
            fastcgi_pass unix:/path/to/site/server.sock;
            include  fastcgi.conf;
            access_log  /var/log/nginx_django.log  main;
        }

        location ~* ^.+\.(mpg|avi|mp3|swf|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|txt|tar|mid|midi|wav|rtf|mpeg))
$ {
            root   /path/to/site/media;
            limit_rate 2000K;
            access_log  /var/log/nginx_django_media.log  download;
            access_log   off;
        }

        location ^~ /static/ {
            root   /path/to/site;
            access_log   /var/log/nginx_django_static.log download;
            expires      30d;
        }

        location /403.html {
            root   /opt/nginx;
            access_log   off;
        }

        location /401.html {
            root   /opt/nginx;
            access_log   off;
        }

        location /404.html {
            root   /opt/nginx;
            access_log   off;
        }

        location = /_.gif {
            empty_gif;
            access_log   off;
        }

}