对 Apache 施加访问限制以防止抓取?

发布于 2024-08-24 18:01:13 字数 166 浏览 2 评论 0原文

问题在于内容网站被严重抓取以至于破坏了服务器。

是否有一种简单的方法可以将 IP 的访问限制为一次或每天固定数量的请求? (每天 10 页或......每 2 分钟 10 页)

理想情况下,我会为搜索引擎保留一个通配符列表,并禁止其他人过快或过多地访问内容。

谢谢你们!

The problem is of a content website that is being scraped so badly that it breaks the server.

Is there an easy method of limiting access for IPs to a fixed number of requests at a time OR per day ? ( 10 pages / day or.... 10 pages every 2 minutes )

Ideally, I would keep a wildcard list for search engines and disallow everybody else from accessing content too fast or too much.

Thanks guys!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

池木 2024-08-31 18:01:13

解决这个问题的一种方法是使用 IPTABLES(仅限 Linux)来防止单个 IP 启动超过指定数量的连接。这是反复试验,因为您需要正确计算它,但总的来说,这应该可以防止攻击者的连接率

iptables -A INPUT -p TCP --dport 80 -m state --state NEW -j STOP-ABUSE
iptables -A STOP-ABUSE -m recent --set
iptables -A STOP-ABUSE -m recent --update --seconds 10 --hitcount 3 -j DROP

希望它有所帮助

One way around this, would be using IPTABLES (linux only) to prevent that individual IPs start more than a specified number of connections. It's trial and error, as you need to calculate it right, but in an overall, that should prevent the attacker's connection rate

iptables -A INPUT -p TCP --dport 80 -m state --state NEW -j STOP-ABUSE
iptables -A STOP-ABUSE -m recent --set
iptables -A STOP-ABUSE -m recent --update --seconds 10 --hitcount 3 -j DROP

Hope it helps

我们的影子 2024-08-31 18:01:13

我更喜欢在系统级别使用 iptables 执行此操作...

但如果您正在寻找基于 Apache 的解决方案,一个想法可能是使用 mod_security

SecGuardianLog< /code>配置指令看起来特别有趣,在您的情况下(引用)

描述:配置指令
使用 httpd-guardian 脚本
监控拒绝服务 (DoS)
攻击。

默认情况下httpd-guardian会防御
针对发送超过
一分钟内 120 个请求,或超过
五分钟内 360 个请求。

I would rather prefer doing that at the system level, using iptables...

But if you're looking for a solution based on Apache, an idea might be to use mod_security.

The SecGuardianLog configuration directive looks especially interesting, in your case (quoting) :

Description: Configuration directive
to use the httpd-guardian script to
monitor for Denial of Service (DoS)
attacks.

By default httpd-guardian will defend
against clients that send more than
120 requests in a minute, or more than
360 requests in five minutes.

心房的律动 2024-08-31 18:01:13

您可以安装 mod_bandwidth 和 mod_limitipconn 等模块来限制带宽使用(全局和每个连接)。

查看 http://mansurovs.com/tech/apache-bandwidth-throtdling 了解更多信息信息。

You can install modules such as mod_bandwidth and mod_limitipconn to limit bandwidth usage (globally and per connection).

Check http://mansurovs.com/tech/apache-bandwidth-throttling for more info.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文