所以我有一个基于正则表达式的位置规则,如下所示:
location ~ /(abc.*xyz|def.*zxy|ghk.*qwe)/
我可以检查正则表达式的哪一部分产生了匹配吗?这意味着如果网址像
/12abc34/
比我想知道它是由
.*abc.*
有办法吗?
我正在 AWS 上的 Debian VM 上运行用 lua-module 编译的最新 nginx。
- - - - - - 更新 - - - - - - -
我正在考虑使用内部位置,但它会很难看:
location ~ /(abc.*xyz|def.*zxy|ghk.*qwe)/
{
location ~ /(abc.*xyz){...}
location ~ /(def.*zxy){...}
...
}
现在我有 60 种正则表达式模式。这种方法可以吗?