Install and use ModEvasive
ModEvasive (mod_evasive) provides a web server with built-in evasive capabilities if it detects that a website may be under attack.
ModEvasive is used to help to prevent DDOS attacks by closing connections if too many requests come into a website too quickly, if a certain child process request is attempting to create too many concurrent requests or if any host IP is trying to access the web server even if blacklisted.