static files and 404

Nick Pearson nick.pearson at gmail.com
Thu Mar 19 21:26:29 MSK 2009


Here's a simplified version of I use the following to accomplish this,
inside my location block:

if ($uri ~* (\.css|\.js|\.ico|\.gif|\.jpg|\.png)) {
  break;
}

Note that I haven't tested this simplified form directly, but I believe it
should work.

On Thu, Mar 19, 2009 at 1:14 PM, Marcelo Barbudas <nostef at gmail.com> wrote:

> Hi,
>
> I have a setup where I am using nginx with RubyOnRails.
>
> The setup looks simple:
> if (!-f $request_filename) {
>  proxy_pass http://domain1;
>  break;
> }
>
> However I have a directory that holds images that sometimes get deleted.
> People keep linking to those images and the 404s go to the rails process.
>
> How can I tell nginx that any request towards:
> /images/subassets/*.gif
> should never be forwarded to rails?
>
> --
> Cheers,
> M.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090319/29e93cb7/attachment.html>


More information about the nginx mailing list