Welcome! Log In Create A New Profile

Advanced

Re: strange if

May 20, 2010 10:08AM
On Thu, May 20, 2010 at 03:29:09PM +0200, Daniele Melosi wrote:

> Hi all,
>
> i'm taking in charge a new nginx cluster with a very strange configurations.
>
> I'm trying rewriting the configuration and i'm unable to find a way to
> better write this if condition:
>
> if ($request_uri !~*
> (^/$|^\/ajax\.php\?type=counter&op=blog&blog(_id|)=.*$.*$|^/\?nl_id=[0-9]+|\?from=[0-9]+|\?confirmkey=.*$|^/post/([0-9]+)(\?[0-9]+|)(\/.*|#.*|\?confirmkey=.*|)$|/post/comment/(saved|close)/([0-9]+)(/[0-9]+|)(\?blog=.*|)$|/permalink/([0-9]+)\.html(#.*)$|/archive/[0-9][0-9][0-9][0-9]-[0-9][0-9]$|/tag(.*|)$|/member/[0-9]+$|/(media|album)(|/[0-9]+\?from=[0-9]+|/[0-9]+)$|/user(.*|)$|/blog|/sitemap(.xml|)|/images/smiley/rhymbox-(.*)/(.*)\.(gif|jpg|png)$|^/[0-9]+$|\?timer=1|check_login\?destination=.*|\?nocache=1))
> {
> error_page 404 /splinder_404.html;
> return 404;
> }
>
> Can it be translated on a location (note the negative !~*).

It's really hard to understand it.
Try to start from this:

location = / {
...
}

location = /ajax.php {
...
}

location ~ ^/post/([0-9]+)$ {
...
}

# etc

# fallback
location ~ / {
alias /path/to/splinder_404.html;
}


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

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

strange if

Daniele Melosi May 20, 2010 09:36AM

Re: strange if

Jérôme Loyet May 20, 2010 09:40AM

Re: strange if

Igor Sysoev May 20, 2010 10:08AM

Re: strange if

mike May 20, 2010 12:38PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 294
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