12 messages in ru.sysoev.nginxRe: static files and 404
FromSent OnAttachments
Marcelo BarbudasMar 19, 2009 11:14 am 
Nick PearsonMar 19, 2009 11:26 am 
MerlinMar 19, 2009 12:18 pm 
Cliff WellsMar 19, 2009 1:21 pm 
Cliff WellsMar 19, 2009 1:22 pm 
Igor SysoevMar 19, 2009 1:30 pm 
Igor SysoevMar 19, 2009 1:31 pm 
Cliff WellsMar 19, 2009 1:36 pm 
Igor SysoevMar 19, 2009 1:39 pm 
Marcelo BarbudasMar 19, 2009 4:13 pm 
Marcelo BarbudasMar 19, 2009 4:33 pm 
MerlinMar 19, 2009 4:51 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: static files and 404Actions...
From:Igor Sysoev (is@rambler-co.ru)
Date:Mar 19, 2009 1:31:19 pm
List:ru.sysoev.nginx

On Thu, Mar 19, 2009 at 12:18:50PM -0700, Merlin wrote:

You can also turn that into a regex location (or location with captures in 0.7) and take it out of the main location block. I am not 100% sure, but my intuition tells me that the location block performs much (well, at least a little) better than the if block. It looks cleaner, anyway :).

Yes, better and much, much cleaner.

On Thu, Mar 19, 2009 at 11:26 AM, Nick Pearson <nick@gmail.com>wrote:

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 <nos@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?