nginx高并发配置
nginx.conf
http {
```
# 限流设置 nginx 控制请求速率
# binary_remote_addr 通过ip进行限流 contentRateLimit 设置漏桶空间大小 rate=2r/s 每秒只允许2个请求
limit_req_zone $binary_remote_addr zone=contentRateLimit:10m rate=2r/s;
```
server {
listen 80;
server_name localhost;
# 测试lua脚本
location /content {
# 配置限流 burst: 并发处理个数; nodelay:无延迟;
limit_req zone=contentRateLimit burst=4 nodelay;
content_by_lua_file /home/sherlock/Workspace/lua/changgou_lua/content.lua;
}
```