how to make nginx find my assets that are not in my public/?

Patrick Aljord patcito at
Tue Aug 16 07:23:23 UTC 2011


So I a rails app that use nginx serving all my assets from my public
directory, but my web app also serves some custom assets directly from
the db. The problem is that nginx tries to look those assets in my
public directory instead of getting them from the app server.
Basically, all the custom assets start with the same path:
"/_files/*". Other assets are served from /images, /stylesheets etc.

Here is my conf:

This is the error I get:

2011/08/16 01:42:06 [error] 17826#0: *40 open()
failed (2: No such file or directory), client:, server:
localhost.lan, request: "GET
/_files/groups/logo/4e48b6f9b002e261db000010.png HTTP/1.1", host:
"localhost.lan", referrer: "http://localhost.lan/"

Thanks in advance,


PS: when I use rails with the basic app server the assets are served
fine (as it all goes through rails app server I guess)

More information about the nginx mailing list