Serving Django's Media Files

CLIFFORD ILKAY clifford_ilkay at
Wed Oct 24 11:32:55 MSD 2007


I have nginx 0.6.3 installed on Debian Etch. I am able to serve Django 
pages via fcgi but I do not have any styling, CSS, or media because any 
attempt to access anything in the site_media directory results in a 403 
being returned by nginx. Here is what I have in my config file.

server {
     listen       localhost:8080;
     server_name  myserver;

     root /home/kane/projects/citadelle/dynaschool;

     location ~* ^.+.(html|jpg|jpeg|gif|png|ico|css|pdf|txt|js)$ {
         expires 30d;

     location / {
         fastcgi_pass unix:/tmp/dynaschool.sock;
         include conf/bots.conf;
         include conf/fastcgi.conf;

The nginx processes are owned by www-data.www-data.

ls -l /home/kane/projects/citadelle/dynaschool
... not showing various irrelevant Django files/directories
drwxr-xr-x 7 kane kane  4096 2007-10-22 02:33 site_media

Changing the ownership of site_media to www-data.www-data made no 
difference. How can I get nginx serving files contained in site_media 

Clifford Ilkay
Dinamis Corporation
1419-3266 Yonge St.
Toronto, ON
Canada  M4N 3P6

+1 416-410-3326

More information about the nginx mailing list