最近网站开始有一些奇怪的请求

出于安全考虑,决定只允许Get/Post请求。
在Nginx配置文件中添加任意一个即可:
1#方法一
2if ($request_method !~ ^(GET|POST)$ ){
3 return 403;
4}
5
6#方法二
7if ($request_method !~* GET|POST) {
8 return 403;
9}
1#快速响应Head请求
2if ($request_method ~ ^(HEAD)$ ) {
3 return 200 "All OK";
4}