Try this:
rewrite ^/\w+/(\w*)/?$ /tms/$1/$arg_sx/$arg_sy/$arg_sz.png;
Nginx doesn't include the query-string in the match for rewrite
. You can access the parameters by name via $arg_name
.
\w
is equivalent to [A-Za-z0-9_]
, so it includes digits.