Nginx 1.0.10 error invalid condition "'!-f"

I have that kind of code which I wanna add to my nginx conf but
unfortunately something is wrong and I don’t know how to fix it…

location ^~ /folder/ {
if ($cookie_amember_nr !~* [a-zA-Z0-9]+) { #no identity
rewrite ^(.*)$
http://localhost/am3/plugins/protect/new_rewrite/login.php?v=-2,1&url=$request_uri?$args
redirect;
}
set $file1
$document_root/am3/data/new_rewrite/$cookie_amember_nr-1;
set $file2
$document_root/am3/data/new_rewrite/$cookie_amember_nr-2;

       if (!-f $file1 && !-f $file2) { #has not access
           rewrite ^(.*)$

http://localhost/am3/plugins/protect/new_rewrite/login.php?v=-2,1&url=$request_uri?$args
redirect;
}

    }

and I’ve got an error in line with : if (!-f $file1 && !-f $file2) {
#has not access

error : "[emerg] invalid condition “'!-f”

how to fix this ?

thank you for help

Posted at Nginx Forum:

Hello!

On Thu, Jul 12, 2012 at 03:09:52AM -0400, google000 wrote:

$document_root/am3/data/new_rewrite/$cookie_amember_nr-1;

and I’ve got an error in line with : if (!-f $file1 && !-f $file2) {
#has not access

error : "[emerg] invalid condition “'!-f”

how to fix this ?

There is no support for the “&&” operator, hence the expression
written is invalid.

http://nginx.org/r/if

Maxim D.

can someone help , if it doesnt support && , i dont know how to make it
works… ?

Posted at Nginx Forum:

ok, problem fixed.

Posted at Nginx Forum: