nginx serving Django static media | 502 bad gateway

Posted by MMRUser on Stack Overflow See other posts from Stack Overflow or by MMRUser
Published on 2010-04-10T09:02:10Z Indexed on 2010/04/10 9:03 UTC
Read the original article Hit count: 629

Filed under:
|
|

I'm trying to serve Django static media through nginx, Here's my nginx.conf

server {
    listen       7777;
    listen       localhost:7777;
    server_name  example.com;

    location / {
        proxy_pass http://localhost:7777;
        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; 
    }

    location /test-app-media/ {
        root /sites/mysite/staticmedia/;
        expires max;
      }
}

but give a 502 bad gateway error, the path to /sites/mysite/staticmedia/ is in the nginx root/ is that the problem..


Django running on Apache 2.2 + mod_wsgi

nginx 0.7.65

Thanks..

© Stack Overflow or respective owner

Related posts about django

Related posts about nginx