【发布时间】:2018-03-17 01:09:54
【问题描述】:
在我的工作中,我被要求将在 iis/azure 上运行的 php 应用程序迁移到通过 nginx 和 fpm 在 GNU+Linux 机器上运行。
然后在进程中我遇到了一个名为web.config 的文件,其中包含例如:
<action name="SomeName" stopProcessing="true">
<match url=".*" ignoreCase="true" />
<conditions>
<add input="{URL}" pattern="^some_regex^">
</conditions>
<action type="Rewrite" url="index.php?someaction={C:1}">
</action>
或者
<action name="SomeName" stopProcessing="true">
<match url=".*" ignoreCase="true" />
<conditions>
<add input="{URL}" pattern="^some_regex^">
</conditions>
<action type="Rewrite" url="index.php?someaction={R:1}">
</action>
到目前为止,我认为像这样的 nginx 映射:
^some_regex^ index.php?someaction=$1;
会在这两个动作中完成这项工作(不知何故)。但是我仍然无法理解正则表达式机器上 {C:1} 和 {R:1} 之间的区别我知道在我的 nginx 中会类似于 $1 (子正则表达式匹配),但与 web.config 不同的是 {C: 1} 和 {R:1} 条目?
我之所以问,是因为我可能需要稍微更改 nginx 的子正则表达式匹配项,以了解匹配项是 {C:1} 还是 {R:1}。
【问题讨论】: