【发布时间】:2020-07-20 20:25:24
【问题描述】:
如何编写包含 foo|bar|baz 或以 /beautifu.html 结尾的 Nginx 正则表达式数学位置?
sth like location ~ ^/.*(foo|bar|baz)/.*$ 但也匹配 .*/beautiful.html
【问题讨论】:
-
|运算符用于分隔替代正则表达式。^/.*和.*$是不必要的。你可以试试:location ~ (foo|bar|baz)/|/beautiful.html$ { ... }
标签: regex nginx pcre nginx-location