Mapping url to physical urls using lua script or something else.

Hemant Bist hemantbist at
Sun Mar 24 00:17:43 UTC 2019

I want to know if this a right way to make the change ( or if there is a
better /recommended method). So far we have only tweaked the configuration
of nginx which scales very nicely for us  The change I need to do looks
like a common case to me.

Currently our urls map directly to the local dir structure
e.g. the url /foo/10000/1234/9999/my.jpg is local file
/var/www/html/foo/10000/1234/9999/my.jpg so

Now the url /foo/first/second/third/my.jpg will map to
where newfoo folder is done by lookup of a  static Hash_map/table of about
10000 to 20000 entries.
new_first (new_second and new_third) are calculated by some arithmatic
operation on first(second and new  third).

My plan is: a) pass all handling to a lua script that will do
internal_redirect to the correct physical url... And do a load test to make
sure that is not too much performance hit.  [ I haven't implemented it, but
it looks possible from the examples I have looked at so far]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list