nginx 限制请求方式

$request_length : 请求长度

$request_method : 请求方式

$status : HTTP响应代码 (1.3.2, 1.2.2)

$nginx_version :NGINX版本

$arg_name :请求中参数名

server {
...

 if ($request_method !~* GET|POST) {
            return 403;

        }

或者

if ($request_method !~ ^(GET|POST)$ )
        {
            return 403;

       }

}

猜你喜欢

转载自blog.csdn.net/weixin_42228950/article/details/106014603