Nginx RP: a lot of rewrite rules

Francis Daly francis at daoine.org
Thu Apr 4 09:34:12 UTC 2013


On Thu, Apr 04, 2013 at 09:01:17AM +0200, Davide D'Amico wrote:

Hi there,

> Is it better to use (in terms of performances, reliability, load on the 
> reverse proxy) the rewrite rules on the nginx reverse proxy, or use the 
> rewrite rules on the apache22 backend?

Completely untested, but it seems that "the earliest place you can do it"
is the right place to do it, at least for a straightforward mechanical
transformation like this.

So I'd say "on nginx".

When you are doing the load-testing, you might want to consider comparing:

* rewrite ^/old /new permanent;
* location = /old { return 301 /new; }
* map new $uri { default 0; /old /new; }
  if ($new) { return 301 /new; }

(Confirm the syntax before testing; these are just some alternative
suggestions.)

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.

Cheers,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list