![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
桐人、
这个作者很懒,什么都没留下…
展开
-
linux监控apache服务,服务关闭将自动重启
#!/bin/bash# Linux监控apache服务,关闭就自动重启URL="https://domin"curlit(){ curl --connect-timeout 10 --max-time 20 --silent "$URL" | grep '200'# 上面的10是连接超时时间,若访问HTTP服务超过10s仍然没有正确响应200头代码,则判断为无法访问。} doit(){ if ! curlit; then echo $(date) "Apache service is原创 2021-05-31 09:56:48 · 384 阅读 · 0 评论 -
用nginx封ip,通过shell脚本将恶意访问的ip封禁
最近服务器被恶意攻击,顾将这些访问次数达到一定数值的ip使用nginx做封禁ip的操作。本文将使用shell脚本分析nginx生成的日志,自动封单个ip访问量大于指定值。因为需要分析nginx的日志,所以我们需要将nginx的日志进行分割处理,因为日志太大,消耗的系统资源也就越多。日志分割可以按天分割,也可以按小时分割。我们的access.log是按天进行分割的。首先选择一个目录,新建一个...原创 2019-08-23 16:48:38 · 2046 阅读 · 0 评论