7 messages in ru.sysoev.nginxRe: if $request_uri , then ...
FromSent OnAttachments
Joe AstonNov 7, 2008 5:21 pm 
cynixNov 7, 2008 10:38 pm 
Joe AstonNov 8, 2008 4:02 am 
RoxisNov 8, 2008 4:38 am 
Joe AstonNov 8, 2008 5:30 am 
Fernando PerezNov 11, 2008 2:35 am 
Joe AstonNov 11, 2008 3:59 am 
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: if $request_uri , then ...Actions...
From:Joe Aston (jo@joeaston.com)
Date:Nov 11, 2008 3:59:22 am
List:ru.sysoev.nginx

Thanks for your suggestion Fernando.

Surely 'if (!-f $request_filename)' performs a stat check to see if the file exists - thereby increasing disk overhead?

Couldn't the regexp be reversed to exclude matching '.php'?

Does this make sense:

location ~ ^/(js|css|images|etc)/(.+)(?<!\.php)$ { root /var/www/domain.com/public; access_log off; expires max; }

(I know that's almost certainly incorrect - but is that kind of regular expression possible?)

Thanks again

On Tue, Nov 11, 2008 at 10:35 AM, Fernando Perez <lis@ruby-forum.com>wrote:

# DO NOT WANT TO USE THIS METHOD (WHICH WORKS): # # If the file exists as a static file serve it # directly without running all # the other rewite tests on it # # if (-f $request_filename) { # break; # } # if (!-f $request_filename) { # rewrite ^/(.+)$ /index.php?q=$1 last; # break; # }

I am curious about why you don't want to use this method. What's wrong with it?

For your regexp problem you can force the accepted extensions too:

location ~ ^/(js|css|images|etc)/(.+)\.(png|gif|css|js)$ { root /var/www/domain.com/public; access_log off; expires max; }

This way php files will not match the regexp and will not get served.