nginx access/deny 到特定路径
nginx access/deny to specific path
我有一个 nginx 虚拟主机,我想:
- 允许访问 http://host.domain/admin/web/index.php/rules_engine
- 拒绝访问 http://host.domain/admin/web/index.php
- index_dev.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;
}
但它不拒绝访问 /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;
}
我有一个 nginx 虚拟主机,我想:
- 允许访问 http://host.domain/admin/web/index.php/rules_engine
- 拒绝访问 http://host.domain/admin/web/index.php
- index_dev.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;
}
但它不拒绝访问 /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;
}