美文网首页
Nginx deny some type of requests

Nginx deny some type of requests

作者: 山猪cn | 来源:发表于2019-06-26 05:48 被阅读0次

1. 限制http请求

if ($request_method !~ ^(GET|HEAD|POST)$ )
{
       return 405;
}

2. 禁止访问特定文件

location ~^/.*.(conf)$
{
    deny all;
}

3. 禁止访问目录

location ~^/admin/$
{
    deny all;
}

4. 禁止访问特定目录下特定文件(用 | 分隔不同文件)

location ~*/uploads/.*.(php|php5)$
{
    deny all;
}

相关文章

网友评论

      本文标题:Nginx deny some type of requests

      本文链接:https://www.haomeiwen.com/subject/efxqcctx.html