nginx - request getting handled by multiple location blocks

view full story

http://serverfault.com – I'm testing a setup where I'd like to have nginx serve up static media and proxy all other requests to another backend. My configuration looks like this: location /media {alias /var/httpd/media;} location / {proxy_pass;} However, if a request is made for a non-existing media resource, e.g. /media/foo.js, nginx tries looking for /var/httpd/media/foo.js and then when not found it also tries to proxy the request to Here are the nginx error logs: 2012/05/18 17:09:21 [error] 10073#0: *1 open() "/var/httpd/media/foo.js" failed (2: No such file o (HowTos)