首先:为了稍微保护 django 管理员,我总是为管理员使用与 /admin/ 不同的 url 一个好主意是将管理员部署为另一个域或子域上的第二个应用程序
您可以通过 IPTABLES/NETFILTER 限制每分钟对整个 webapp 的请求。可以在debian 管理员处找到如何完成此操作的教程。这是一个如何保护 ssh 端口的示例,但您可以对 http 使用相同的技术。
您可以使用 NginxHttpLimitZone 模块来限制分配会话的同时连接数,或者作为一种特殊情况,从一个 IP 地址开始。编辑 nginx.conf:
来自www.cyberciti.biz
### Directive describes the zone, in which the session states are stored i.e. store in slimits. ###
### 1m can handle 32000 sessions with 32 bytes/session, set to 5m x 32000 session ###
limit_zone slimits $binary_remote_addr 5m;
### Control maximum number of simultaneous connections for one session i.e. ###
### restricts the amount of connections from a single ip address ###
limit_conn slimits 5;
The above will limits remote clients to no more than 5 concurrently "open" connections per remote ip address.