if $request_uri , then ...

Joe Aston joe at joeaston.com
Tue Nov 11 14:59:45 MSK 2008


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 <lists at 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.
> --
> Posted via http://www.ruby-forum.com/.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20081111/850a7be4/attachment.html>


More information about the nginx mailing list