直接return 403即可
location = /testUrl {
return 403;
}
上述配置将只禁用http://ip:port/testUrl 的请求
2. nginx禁用不安全的请求仅保留 GET、POST 方法
全局配置方式
server {
listen 80;
server_name www.iwen.com;
#return 301 https://$server_name$request_uri;
if ($request_method !~ ^(GET|POST)$) {
return 403;
}
.......
.......
}
局部配置方式
location /knowlege_app {
include /usr/local/nginx/allow_ip_list.conf;
if ($request_method !~ ^(GET|POST)$) {
return 403;
}
}



