Serving static files fails - nginx

Posted by Sergei on Server Fault See other posts from Server Fault or by Sergei
Published on 2010-11-07T05:08:59Z Indexed on 2011/03/09 8:12 UTC
Read the original article Hit count: 314

Filed under:
|
|
|

Hi, I've been looking and trying around all night, but without success.

I configured nginx to serve my static files and proxy all the other traffic:

server {

    listen 80;
    server_name mydomain.com;

    access_log /home/boudewijn/www/bbt/brouwers/logs/access.log;
    error_log /home/boudewijn/www/bbt/brouwers/logs/error.log;

    location / {
            proxy_pass http://127.0.0.1:8080;
            include /etc/nginx/proxy.conf;
    }

    location /media/ {
            root    /home/boudewijn/www/bbt/brouwers/;
    }
}

The proxy passing is no problem, but when I go to mydomain.com/media/ or try to access any testfile over there, it's without success. I paid attention to the difference between root and alias, my media folder exists, I paid attention to the trailing slashes, but still I get a 404 when trying to access my static media files.

Any help?

© Server Fault or respective owner

Related posts about nginx

Related posts about django