# Nginx-0.6.36 =\> unknown directive "if"

**URL:** <https://www.ruby-forum.com/t/nginx-0-6-36-unknown-directive-if/165780>\
**Category:** Deployment\
**Created:** [April 17, 2009, 12:03pm UTC](https://www.ruby-forum.com/t/nginx-0-6-36-unknown-directive-if/165780 "2009-04-17T12:03:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![temesta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e9bcb4/32.png) [@temesta](https://www.ruby-forum.com/u/temesta)\
**Post date:** [April 17, 2009, 12:03pm UTC](https://www.ruby-forum.com/t/nginx-0-6-36-unknown-directive-if/165780/1 "2009-04-17T12:03:13Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![temesta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e9bcb4/32.png) [@temesta](https://www.ruby-forum.com/u/temesta)\
**Post date:** [April 18, 2009, 8:52pm UTC](https://www.ruby-forum.com/t/nginx-0-6-36-unknown-directive-if/165780/2 "2009-04-18T20:52:41Z")

</div>

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