for nginx look at Limit Requests http://wiki.nginx.org/HttpLimitReqModule - or if not running 0.7.20 or newer, try Limit Zone. This is the best if you're just looking to control things with nginx, but I would also recommend putting HAproxy in front of it and have it handle the connections limit, a much richer feature set to handle such things. It handles slow DDos attacks like Slowaris automatically http://www.snapt-ui.com/haproxy/defend-against-slowloris-wit... - and is able to do tons more. Here Willy (HAproxy developer) talks about other things he's done with it http://www.mail-archive.com/haproxy@formilux.org/msg00291.ht...