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

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Maarten P. (Guest)
on 2009-04-17 14:03

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?

Ismael C. (Guest)
on 2009-04-18 22:52
Did you find a solution to this? I'm having the same problem.
This topic is locked and can not be replied to.