nginx 1.0.10 error [emerg] invalid condition "'!-f"

google000 nginx-forum at nginx.us
Thu Jul 12 07:09:52 UTC 2012


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: http://forum.nginx.org/read.php?2,228528,228528#msg-228528



More information about the nginx mailing list