Hi Matt, Your issue seems oddly familiar to me but I forget how I fixed it. I'm running nginx-0.7.34 built from source and django trunk Rev: 10558. I would try doing a source build of the current release of nginx which is 0.7.60 first to see if that fixes it. The fastcgi_params are also picky so check those too.
Here's how I start mine up. su -m -c 'python /var/django/projects/gis/manage.py runfcgi --settings=gis.settings method=prefork pidfile=/tmp/django.pid host=127.0.0.1 port=8800' nobody /bin/sh NGINX conf: location /viewer/ { fastcgi_pass 127.0.0.1:8800; include fastcgi_params; fastcgi_pass_header Authorization; fastcgi_intercept_errors off; } and my fastcgi_params are: fastcgi_param PATH_INFO $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 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; # PHP only, required if PHP was built with --enable-force-cgi-redirect fastcgi_param REDIRECT_STATUS 200; -Matt On Thu, Jun 18, 2009 at 12:52 AM, Matt Davies <tonm...@gmail.com> wrote: > > I'm on ubuntu hardy heron, 2.6.24-19-server 64 bit > nginx/0.5.33 > django 1.0.2 > Python 2.5.2 > mysql 5.0.51a-3ubuntu5.4 > > Here's how I installed everything from the beginning > > http://pastie.org/515408 > > Here's how I restart my django app > > #!/bin/sh > if [ -f /var/www/django/conf/pid/$1.pid ]; then > echo stopping $1 site > kill `cat /var/www/django/conf/pid/$1.pid` > else > echo $1 was not running > fi > /usr/bin/python /var/www/django//$1/manage.py runfcgi method=prefork > minspare=1 maxspare=1 socket=/var/www/django/conf/sockets/$1.sock > pidfile=/var/www/django/conf/pid/$1.pid > chmod 777 /var/www/django/conf/sockets/$1.sock > > Here's the server directive in the /etc/nginx/sites-available/default file > server > { > listen 80; > server_name $1.com; > access_log /var/www/django/log/access.log; > error_log /var/www/django/log/error.log error; > location / > { > fastcgi_pass unix:/var/www/django/conf/sockets/$1.sock; > fastcgi_param SERVER_NAME $server_name; > fastcgi_param SERVER_PORT $server_port; > fastcgi_param SERVER_PROTOCOL $server_protocol; > fastcgi_param PATH_INFO $fastcgi_script_name; > fastcgi_param REQUEST_METHOD $request_method; > fastcgi_param QUERY_STRING $query_string; > fastcgi_param CONTENT_TYPE $content_type; > fastcgi_param CONTENT_LENGTH $content_length; > fastcgi_pass_header Authorization; > fastcgi_intercept_errors off; > } > } > > Here's the /etc/nginx/nginx.conf > user username groupname; > worker_processes 6; > error_log /var/log/nginx/error.log; > pid /var/run/nginx.pid; > events { > worker_connections 1024; > } > http { > include /etc/nginx/mime.types; > default_type application/octet-stream; > access_log /var/log/nginx/access.log; > sendfile on; > #tcp_nopush on; > #keepalive_timeout 0; > keepalive_timeout 65; > tcp_nodelay on; > gzip on; > include /etc/nginx/sites-enabled/*; > } > > Every now and then the web site returns a 502 bad gateway error. It's > a very small site with hardly any traffic, so resources are not a > problem. It usually happens immediately after I restart the site with > the script above, I'm wondering if the restarting is a problem. > > Here's what nginx says about it, running in error mode > > 2009/06/17 17:09:22 [error] 17715#0: *10888 connect() to > unix:/var/www/django/conf/sockets/$1.sock failed (111: Connection > refused) while connecting to upstream, client: 82.15.29.187, server: > servername, URL: > "/news/2009/jun/09/summer-fund-now-open-applications-continuing-stude/", > upstream: "fastcgi://unix:/var/www/django/conf/sockets/$1.sock:", > host: "servername", referrer: "http://somewebsite.com/" > > I've switched file caching on now in django, so I'm not getting any > errors any more, but I need to understand what is causing those > errors, for my own sanity if nothing else > > I can get any log information if needed, and perform any tests. I > think I've got something setup slightly wrong, but I have no idea what > it is. > > If anyone can shed any light on the topic I'd be most grateful. > > V > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---