微慑信息网

服务器安全

为了安全起见,我们一般会对上传目录禁止运行php脚本

修改nginx.conf配置文件

禁止单目录:

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

禁止多目录:

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

需要注意两点:
1、以上的配置文件代码需要放到 location ~ .php{…}上面,如果放到下面是无效的

2、attachments需要写相对路径,不能写绝对路径

3、不要忘记重启nginx呀,service nginx restart
———————

本文标题:服务器安全
本文链接:
(转载请附上本文链接)
https://vulsee.com/archives/vulsee_2019/0510_7487.html
转载请附本站链接,未经允许不得转载,,谢谢:微慑信息网-VulSee.com » 服务器安全
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

微慑信息网 专注工匠精神

访问我们联系我们