I'm trying to set up a new server to host several existing django
sites.  The stack is:

Ubuntu Hardy Heron
Apache 2.2 MPM Worker w/ mod_wsgi (for dynamic content)
Nginx (for static files)

I'm migrating away from mod_python.  The django apps run correctly
under apache mod_wsgi - I've tested this by running the sites under
Apache directly on port 80, everything works swimmingly.

Then, I put up an nginx instance to reverse proxy the dynamic content
and serve static files directly.  nginx serves the static files
correctly, but the dynamic content hangs indefinitely, eventually
throwing a 504 timeout error to the browser and leaving this message
in the nginx error log:

2008/09/26 00:38:05 [error] 3544#0: *10 upstream timed out (110:
Connection timed out) while connecting to upstream, client:
198.28.57.218, server: mysite.com, URL: "/whatever/53/", upstream:
"http://127.0.0.1:8080/whatever/53/";, host: "mysite.com"

I'm using the exact same nginx virtualhost config as I did under
mod_python.  Am I wrong to assume that this should Just Work™?  Has
anyone else experienced this problem when moving from mod_python to
mod_wsgi?  Any suggestions on what might be going wrong here?

I feel as if I've ruled out the "usual suspects" of file permissions
and path errors because dynamic content  works perfectly under apache
(apache port 8080 while running nginx works as well!)  But the
requests for dynamic content via nginx port 80 always time out.

Any help would be greatly, greatly appreciated.

Here are my config files:

--- apache.wsgi ---

import os, sys

apache_configuration= os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(workspace)

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

--- Apache vhost file ---

<VirtualHost *:8080>
        ServerName mysite.com
        ServerAdmin [EMAIL PROTECTED]

        WSGIScriptAlias / /home/django/django-sites/mysite.com/mysite/
apache/apache.wsgi

       <Directory /home/django/django-sites/mysite.com/mysiteapache>
       Order deny,allow
       Allow from all
       </Directory>

        # Log files in custom directory /var/log/apache2/vhosts
        LogLevel debug
        ErrorLog /var/log/apache2/mysite.com/error.log
        CustomLog /var/log/apache2/mysite.com/access.log combined
</VirtualHost>


--- nginx vhost file ---

server {
        listen       80;
        server_name  mysite.com;

        # Main location
        location / {
            proxy_pass         http://127.0.0.1:8080/;
            proxy_redirect     off;

            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For
$proxy_add_x_forwarded_for;

            client_max_body_size       10m;
            client_body_buffer_size    128k;

            proxy_connect_timeout      90;
            proxy_send_timeout         90;
            proxy_read_timeout         90;

            proxy_buffer_size          4k;
            proxy_buffers              4 32k;
            proxy_busy_buffers_size    64k;
            proxy_temp_file_write_size 64k;
        }

        # Static files location
        location /media/ {
            root   /var/www/mysite/;
        }
    }

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to