nginx access/deny 到特定路径

nginx access/deny to specific path

我有一个 nginx 虚拟主机,我想:

这是我目前想要的

location ^~ /admin/web/index[_dev]*.php/rules_engine {
  allow all;
  if (!-f $request_filename) {
    rewrite ^ /admin/web/index.php$is_args$args last;
  }
}

location /admin/web/index[_dev]*.php {
  deny all;
}

但它不拒绝访问 /admin/web/index。php

谁能指出我错在哪里?

为了后代,以下配置起到了作用:

  location ^~ /admin/web/index[_dev]*\.php/rules_engine {
    allow all;
    if (!-f $request_filename) {
      rewrite ^ /admin/web/index.php$is_args$args last;
    }
  }

  location ~ /admin/web/index[_dev]*\.php(/$|$) {
    deny all;
  }