Welcome! Log In Create A New Profile

Advanced

Updating some old "if" statements

Ian M. Evans
September 27, 2012 03:36PM
A few years back this list helped me create some locations that allowed
some extensionless files to run as php and pass the rest of their path
along as a variable. I'm wondering if there's been any changes or tweaks
over the years that would make these locations run less efficiently than
they could be. As I'm reading this more I'm seeing "If is evil" right?

Location #1:

location ~ /(photos|profile|review|profiles|reviews|news)(/|$) {
if ($uri ~ ^(.*/(photos|profile|review|profiles|reviews|news))($|/.*)) {
rewrite ^(.*/(photos|profile|review|profiles|reviews|news))($|/.*)
$1.php?mypath=$3 last;
}
}

Location #2:

location ~ ^/galleries(/.*$|$) {
if (-f /usr/local/nginx/htdocs/pixcache$request_uri/index.html) {
expires 2h;
rewrite ^(.*)$ /pixcache$1/index.html last;
break;
}
rewrite ^/galleries(/.*$|$) /galleries.php?mypath=$1 last;
}

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
SubjectAuthorPosted

Updating some old "if" statements

Ian M. EvansSeptember 27, 2012 03:36PM

Re: Updating some old "if" statements

Edho AriefSeptember 28, 2012 07:16AM

Re: Updating some old "if" statements

Ian EvansSeptember 28, 2012 09:40PM

Re: Updating some old "if" statements

Edho AriefSeptember 28, 2012 11:48PM

Re: Updating some old "if" statements

Ian M. EvansSeptember 29, 2012 04:48PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 122
Record Number of Users: 4 on November 26, 2014
Record Number of Guests: 155 on November 26, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready