kmswilliam 2021-10-19 20:47 采纳率: 100%
浏览 11
已结题

Nginx location 中不能使用正则表达式中的匹配限定符

使用正则表达式来配置 location 时报如下错误

nginx: [emerg] unknown directive "2}\w/$" in /usr/local/nginx/conf/nginx.conf:50

配置大代码块如下

location ~/\d{2}\w/$ {   
    root   html;         
    index  index.html index.htm;
}                        

我的问题是, 怎么才能在 location ~ 中使用正则表达式中的 { } 这种匹配限定符呢

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 10月27日
    • 创建了问题 10月19日