Welcome! Log In Create A New Profile

Advanced

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

Maxim Dounin
November 24, 2009 02:20PM
Hello!

On Tue, Nov 24, 2009 at 12:37:44PM -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?
>
> 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

You have to remove "--without-http_rewrite_module" configure
argument. It disables rewrite module where "if" directive
defined.

[...]

> 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/;
> }

Also, it's good idea to use try_files or error_page fallback
instead. See here for details:

http://wiki.nginx.org/NginxHttpCoreModule#error_page
http://wiki.nginx.org/NginxHttpCoreModule#try_files

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Can not configure pcre on CENTOS

johndesp November 24, 2009 10:36AM

Re: Can not configure pcre on CENTOS

Christopher Smith November 24, 2009 10:50AM

Re: Can not configure pcre on CENTOS

Igor Sysoev November 24, 2009 11:02AM

Re: Can not configure pcre on CENTOS

Maxim Dounin November 24, 2009 11:08AM

Re: Can not configure pcre on CENTOS

johndesp November 24, 2009 11:50AM

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

johndesp November 24, 2009 12:08PM

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

Maxim Dounin November 24, 2009 02:20PM

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

Igor Sysoev November 24, 2009 12:58PM

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

Mark Maunder November 24, 2009 01:14PM

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

johndesp November 24, 2009 01:14PM

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

Igor Sysoev November 24, 2009 04:10PM

Thanks for all your Help -

johndesp November 25, 2009 05:35AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 254
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready