发布时间:2017-12-05 23:19:53编辑:Run阅读(5403)
web拒绝访问,有人会说用iptables策略?是可以,但不是最好的方法
最有效,最好的方法,是直接在nginx上拒绝某个地址访问
先新建一个blockips.conf配置文件
cd /usr/local/nginx/conf/
vim blockips.conf
deny 42.159.145.18;
然后在http里面添加进去
vim /usr/local/nginx/conf/nginx.conf
include blockips.conf;

/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx -s reload
在观察nginx的access.log日志

全部都是403了,已经达到拒绝访问的效果了
上一篇: python调用linux系统命令
下一篇: 安装iostat
 51250
 50685
 41286
 38107
 32570
 29471
 28333
 23195
 23160
 21488
 1564°
 2284°
 1890°
 1829°
 2142°
 1876°
 2565°
 4298°
 4150°
 2959°