Forum: Rails deployment nginx-0.6.36 => unknown directive "if"

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
01ff060e4998723d020cd0ad6fa8c7ad?d=identicon&s=25 Maarten Porters (temesta)
on 2009-04-17 12:03
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
93894025c277e9617911a949f1848a21?d=identicon&s=25 Ismael Celis (ismasan)
on 2009-04-18 20:52
Did you find a solution to this? I'm having the same problem.
This topic is locked and can not be replied to.