nginx配置 防ddos
2015-12-25 11:00
531 查看
## 用户的 IP 地址 $binary_remote_addr 作为 Key,每个 IP 地址最多有 50 个并发连接
## 你想开 几千个连接 刷死我? 超过 50 个连接,直接返回 503 错误给你,根本不处理你的请求了
limit_conn_zone
$binary_remote_addr
zone=TotalConnLimitZone:10m
;
limit_conn TotalConnLimitZone 50;
limit_conn_log_level
notice;
## 用户的 IP 地址 $binary_remote_addr 作为 Key,每个 IP 地址每秒处理 10 个请求
## 你想用程序每秒几百次的刷我,没戏,再快了就不处理了,直接返回 503 错误给你
limit_req_zone
$binary_remote_addr
zone=ConnLimitZone:10m rate=10r/s;
limit_req_log_level notice;
## 具体服务器配置
server
{
listen
80;
location
~ \.php$
{
## 最多 5 个排队, 由于每秒处理 10 个请求 + 5个排队,你一秒最多发送 15 个请求过来,再多就直接返回 503 错误给你了
limit_req
zone=ConnLimitZone
burst=5
nodelay;
fastcgi_pass
127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
}
## 你想开 几千个连接 刷死我? 超过 50 个连接,直接返回 503 错误给你,根本不处理你的请求了
limit_conn_zone
$binary_remote_addr
zone=TotalConnLimitZone:10m
;
limit_conn TotalConnLimitZone 50;
limit_conn_log_level
notice;
## 用户的 IP 地址 $binary_remote_addr 作为 Key,每个 IP 地址每秒处理 10 个请求
## 你想用程序每秒几百次的刷我,没戏,再快了就不处理了,直接返回 503 错误给你
limit_req_zone
$binary_remote_addr
zone=ConnLimitZone:10m rate=10r/s;
limit_req_log_level notice;
## 具体服务器配置
server
{
listen
80;
location
~ \.php$
{
## 最多 5 个排队, 由于每秒处理 10 个请求 + 5个排队,你一秒最多发送 15 个请求过来,再多就直接返回 503 错误给你了
limit_req
zone=ConnLimitZone
burst=5
nodelay;
fastcgi_pass
127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
}
相关文章推荐
- Nginx 基础架构
- nginx做负载均衡配置
- nginx(2) 日志文件的格式和存储路径
- FastDFS+Nginx安装配置
- 配置 CentOS 7 + PHP 5.6 + Nginx + Mysql + Composer + Laravel ......
- Linux系统上Nginx+Python的web.py与Django框架环境
- 在Linux系统上通过uWSGI配置Nginx+Python环境的教程
- Windows系统下使用flup搭建Nginx和Python环境的方法
- 在Windows系统上搭建Nginx+Python+MySQL环境的教程
- nginx lua 文件下载
- 2015第52周-Nginx
- CenterOS 6.5操作系统 Nginx下配置 NodeJS
- nginx(1) 启动和停止,重启
- 日记 - nginx+php的“No input file specified.”问题
- nginx php环境搭建
- Nginx之proxy_redirect详解
- nginx基本配置与参数说明
- ubuntu 12.04.5下利用nginx 搭建RTMP服务器
- nginx配置文件nginx.conf的扩展
- HLS/MPEG-DASH/RTMP with nginx