Can't upload media files using django + nginx
<p>I'm using django+nginx based on andrecp git - <a href="https://github.com/andrecp/django-tutorial-docker-nginx-postgres" rel="nofollow noreferrer">https://github.com/andrecp/django-tutorial-docker-nginx-postgres</a></p>

<p>This is the nginx.conf file:</p>

<pre><code>worker_processes 1;

events {

    worker_connections 1024;

}

http {

    include /etc/nginx/mime.types;

    gzip on;
    gzip_proxied any;
    gzip_types text/plain text/xml text/css application/x-javascript;
    gzip_vary on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";


    server {
        listen 80;
        server_name mysite.com;

        client_max_body_size 20M;
        charset     utf-8;

        access_log /dev/stdout;
        error_log /dev/stdout info;

        location /static {
            alias /usr/src/app/static;
        }

        location /static/myapp/js/ {
          default_type text/javascript;
          alias /usr/src/app/static/myapp/js/;
        }

        location /static/myapp/css/ {
          default_type text/css;
          alias /usr/src/app/static/myapp/css/;
        }

        location /media {
            alias /usr/src/app/media;
        }

        location / {
            proxy_pass http://django:8000;
            proxy_set_header   Host $host;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Host $server_name;
        }
    }
}
</code></pre>

<p>and this is my model:</p>

<pre><code>class RSSfeeds(models.Model):
    site_name = models.CharField('Site Name', max_length=100)
    feed_name = models.CharField('Feed Name', max_length=100)
    feed_url = models.CharField('URL', max_length=1000)
    img = models.ImageField('Image', upload_to='img/', null=True, blank=True)
</code></pre>

<p>I have a simple form on my site with image upload input.
When I'm on DEBUG=TRUE the files are uploading as expected, but I think django handles them and not Nginx (cause they are placed inside the django folder).
When DEBUG=False nothing happens - I send the form, the textual data is stored correctly but the image isn't saved.</p>

<p>What am I doing wrong?</p>

<p>Thanks!</p>

<p>UPDATE:</p>

<pre><code>server {
        listen 80;
        server_name yourserver.com;

        client_max_body_size 50M;
        charset     utf-8;

        location /static {
            alias /www/static;
        }

        location /media {
            alias /www/media;
        }

        location / {
            proxy_pass http://django:8000;
            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;
            proxy_set_header   X-Forwarded-Host $server_name;

        }
    }
</code></pre>