django : Serving static files through nginx

I think using root in location block is incorrect. I use alias and it works fine, even without re-configuring django.

# django settings.py
MEDIA_URL = '/static/'

# nginx server config
server {   
    ...
    location /static {    
        autoindex on;    
        alias /opt/aa/webroot/;    
    }
}

Hope this makes things simpler.

Leave a Comment