Nginx location block and performance

时间:2016-02-12 19:24:15

标签: magento nginx url-redirection nginx-location

I am not an expert with Nginx, so I read several articles and the official guideline to get myself up to speed. However, I found nothing that touch base on the location vs rewrite block performance.

My scenario is the following: an existing website changed their english URLs into Chinese, and I have to prevent any loss of traffic for several URLs.

I came up with two working configuration, though this was limited to just a few URLs and I wasn't able to test on any production or pre-production environment to validate the effectiveness.

Solution A)

Use n+1 rewrite blocks followed by a permanent flag straight in the server block;

Solution B)

Use n+1 exact location blocks with a nested rewrite and permanent flag followed by a break;

Both solutions have a catch all rule that redirect to an index.php file to allow Magento process the request and produce the output.

My understanding is that solution B may be more efficient thanks to the break instruction that will prevent additional rewriting rule to be executed, forwarding the rewrite module straight to the location blocks. As I have only one of them - a catch all - there is very little choice here.

Given the above, is it correct assuming the solution B is more correct?

0 个答案:

没有答案