unknown directive "if" in /usr/local/nginx/nginx.conf

Igor Sysoev igor at sysoev.ru
Tue Nov 24 20:53:08 MSK 2009


On Tue, Nov 24, 2009 at 12:08:10PM -0500, johndesp wrote:

> Guys,
> 
> The following is what I have done. My goal is ultimately use regex to inspect the incoming URI and make proxy_pass decisions. The if statement below is just a test to validate the if statements work.  As you can see, I get the "unkown directive" error.  Do you think I need to use the --with-pcre= option?

The "if" directive is in disabled http_rewrite_module.

>     yum install gcc openssl-devel pcre-devel zlib-devel
>     yum install mlocate
> 
> ./configure --sbin-path=/sbin/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-http_perl_module --without-http_rewrite_module
> 
> make
> sudo make install
> 
> 
> 
> ============================= snippet from nginx.conf=============================
> 
> location /johndesp/ {
>           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 off;
>        proxy_pass_request_headers on;
>        if (!-f $request_filename) {
>            proxy_pass http://ec2-75-101-166-203.compute-1.amazonaws.com:8080/johndesp/;
>      }
> ========================================================================

 location /johndesp/ {
     try_files  $uri  @amazonaws;
 }

 location @amazonaws {
       proxy_pass http://ec2-75-101-166-203.compute-1.amazonaws.com:8080/johndesp/;
       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    off;
 }


-- 
Igor Sysoev
http://sysoev.ru/en/




More information about the nginx mailing list