Nginx-0.6.36 => unknown directive "if"


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

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

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

upstream halenjeugdt {

server {
listen 80;
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_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;
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?


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