nginx配置黑名单

2018年4月3日 zhangdd 50 0 评论 nginx

获取各个IP访问次数

awk ‘{print $1}’ /usr/local/nginx/logs/access.log |sort |uniq -c|sort -n

新建一个黑名单文件 blacklist.conf ,放在 nginx/conf/vhost下面。

添加一个IP ,deny 192.168.100.1;

在http或者server模块引入

include vhost/blacklist.conf ;

需要重启服务器

/usr/local/nginx/sbin/nginx -s reload; 即可生效

本文声明: 本文出自张佃栋de博客,转载时请注明出处及相应链接。

永久链接: https://zhangdd.com/115.html

最后编辑: 2018/04/03

©著作权归作者所有