Nginx-0.6.36 => unknown directive "if"


#1

Hi,

I just installed passenger + nginx on my server. Unfortunately my config
seems to be broken now with the new NGINX.

I’m getting this error:

[emerg] 4217#0: unknown directive “if” in
/usr/local/nginx/conf/halenjeugdt.conf:19

I searched on google and according to this article it’s just about a
missing space:

http://gregsidberry.com/2009/01/26/nginxif-not-if/

Even with the extra space, I’m still getting this error. Here is my
config:

upstream halenjeugdt {
server 127.0.0.1:8010;
}

server {
listen 80;
server_name www.halenjeugdt.be halenjeugdt.be;
charset utf-8;
access_log logs/halenjeugdt_access.log main;

index  index.html index.htm;

location / {
        proxy_set_header  X-Real-IP  $remote_addr;
        proxy_set_header  X-Forwarded-For

$proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect false;

        if (-f $request_filename/index.html) {
          rewrite (.*) $1/index.html break;
        }
        if (-f $request_filename.html) {
          rewrite (.*) $1.html break;
        }
        if (!-f $request_filename) {
          proxy_pass http://halenjeugdt;
          break;
        }
}
error_page   500 502 503 504  /50x.html;
location = /50x.html {
        root   html;
}
error_page  404              /404.html;

}

Everything looks fine to me. Does anyone have a clue?

Tnx


#2

Did you find a solution to this? I’m having the same problem.