Welcome! Log In Create A New Profile

Advanced

Re: Nginx RP: a lot of rewrite rules

Francis Daly
April 04, 2013 02:20PM
On Thu, Apr 04, 2013 at 12:20:42PM +0200, Davide D'Amico wrote:
> Il 04/04/13 11:34, Francis Daly ha scritto:
> >On Thu, Apr 04, 2013 at 09:01:17AM +0200, Davide D'Amico wrote:

Hi there,

> >I suspect that the suggestions are increasingly more efficient -- but
> >you presumably have the interest to find out for sure, on your hardware
> >and with your expected loads.
>
> Thank you Francis, but I cannot "group" all the rewrite I have so I am
> starting using all these rewrites on backends (where I have rewritemaps,
> too) and later I'll test them on nginx.

I may have been unclear. I'm not talking about grouping the rewrites;
I'm talking about a list of desired old -> new redirections, which
presumably you have somewhere.

Get the /oldN -> /newN local urls that you care about, and in nginx you
can try (and I have now tested this):

===
http {

map $uri $new {
default "";
/old3 /new3;
/old4 /new4;
}

server {
listen 8000;

if ($new) {
return 301 $new;
}

location = /old1 { return 301 /new1 ;}
location = /old2 { return 301 /new2 ;}
}

}
===

and look at the output of things like

curl -I http://localhost:8000/old1

Test twice, once with many "location =" lines and no map/if; and the other
time with many lines inside the map and no special "location =" lines;
in order to know which is better on your system.

Anyway, if you have something working well enough for you now, then you
don't need to change anything. But when the time comes, this is a more
specific example of what I was suggesting.

f
--
Francis Daly francis@daoine.org

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

Nginx RP: a lot of rewrite rules

davide.damico April 04, 2013 03:02AM

Re: Nginx RP: a lot of rewrite rules

Francis Daly April 04, 2013 05:36AM

Re: Nginx RP: a lot of rewrite rules

Francis Daly April 04, 2013 02:20PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 77
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready