1、打开nginx配置文件 cd /data/nginx/conf vim nginx.conf
2、修改nginx配置文件,如下图
在server下的location中增加if判断
if (
r
e
q
u
e
s
t
m
e
t
h
o
d
!
(
G
E
T
∣
P
O
S
T
∣
H
E
A
D
)
request_method !~ ^(GET|POST|HEAD)
requestmethod! (GET∣POST∣HEAD) ) {
return 400;
}
修改之后保存退出
重启nginx 进入cd /data/nginx/sbin下 命令:./nginx –s reload
最后
以上就是无奈斑马最近收集整理的关于NGINX配置禁用http请求方式的全部内容,更多相关NGINX配置禁用http请求方式内容请搜索靠谱客的其他文章。
发表评论 取消回复