Nginx配置问题汇总

2、是否限制可用的方法----------if ($request_method !~ ^(GET|HEAD|POST)$ ) {return 444; }在哪里配置?
[color=blue]---该段代码的作用是屏蔽非GET、HEAD或POST类型请求,返回XXX状态码。
根据作用范围,配置在server、location中都可以。
参考:
server {
listen 8083;
server_name localhost;
if ($request_method !~ ^(GET|HEAD|POST)$ )
{
return 403;
}
……
}[/color]
3、是否存在目录遍历 ----------没有autoindex参数是否合格?
[color=blue]---nginx默认autoindex为off,一般不需要配置。
ngx_http_autoindex_module配置参考:http://wiki.nginx.org/NginxChsHttpAutoindexModule
http://www.ctohome.com/FuWuQi/46/375.html
配置参考:
location ^~/ui/ {
root /netapp/applications/NetbWeb4;
expires max;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}

配置前访问效果

[img]http://dl.iteye.com/upload/attachment/0071/9687/ae38da4e-18fc-36a1-87c8-da60a626089b.png[/img]

配置后访问效果

[img]http://dl.iteye.com/upload/attachment/0071/9689/75f9c2b5-414a-3489-93c6-4ed1faeb61d9.png[/img]

[/color]

4、是否存在文件类型解析漏洞----------location 节点中无try_files $fastcgi_script_name = 404;是否合格?
[color=blue]---1)该漏洞应该是针对nginx解析php的,目前我们的应用没有使用php,并已在nginx配置中设有屏蔽,如下
location ~* \.(php|asp|aspx)$ {
rewrite ^(.*) http://172.19.67.1:8083/404.html redirect;
}
2)若应用中采用php,则可以采用以下方式解决
关闭cgi.fix_pathinfo为0
或者
if ( $fastcgi_script_name ~ \..*\/.*php ) {
return 403;
}
参考:http://www.80sec.com/nginx-securit.html[/color]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值