This apache module may give you a little breathing room during DDOS attacks.
yum install mod_evasive -y
Next restart apache
systemctl restart httpd.service
Check if mod_evasive is loaded
httpd -M | grep evasive
You should get an output like below.
evasive20_module (shared)
Now that we are a bit more secure we can modify the configuration a bit.
Create a directory for the logfiles default is /tmp which is not secure enough.
mkdir /var/log/mod_evasive chown -R apache:apache /var/log/mod_evasive
Next let's tweak the configuration file a bit
cd /etc/httpd/conf.d/
vi mod_evasive.conf
Find the following line:
DOSBlockingPeriod 10
Change it to
DOSBlockingPeriod 300
Find the following line:
#DOSLogDir "/var/lock/mod_evasive"
Remove the # (hash) and change it to
DOSLogDir "/var/log/mod_evasive"
Restart apache for the changes to take effect
systemctl restart httpd.service
Check if the module is loaded
httpd -M | grep evasive