Skip to main content

高级配置

多网站配置

如果有多个网站,可以分别为每个网站创建独立的防护:

[nginx-site1]
enabled = true
port = http,https
filter = nginx-access
logpath = /www/wwwlogs/site1.log
maxretry = 40
findtime = 60
bantime = 604800

[nginx-site2]
enabled = true
port = http,https
filter = nginx-access
logpath = /www/wwwlogs/site2.log
maxretry = 30
findtime = 60
bantime = 86400

邮件通知配置

配置封禁时发送邮件通知:

[nginx-access]
action = iptables-multiport[name=nginx-access, port="http,https"]
         sendmail-whois[name=nginx-access, dest=admin@yourdomain.com, sender=fail2ban@yourdomain.com]