Quantcast
Viewing all articles
Browse latest Browse all 972

Nginx location block and performance

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 (about 1m)

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 efficient?

Viewing all articles
Browse latest Browse all 972

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>