Know the kind of attack
| Attack type | What happens | What stops it |
|---|---|---|
| Volumetric flood | Huge amounts of traffic fill the network link | Network-level DDoS protection before the server |
| Connection flood | Many connections from a few addresses exhaust the web server | Connection limits in the firewall, such as CSF or DDoS-Deflate |
| Application-layer (HTTP) flood | Many valid-looking page requests overload PHP and the database | Rate limits, caching, a WAF or Cloudflare |
| Slow requests (slowloris) | Connections are held open very slowly | Request timeouts in the web server |
See what is happening right now
Count the connections per IP address to the web ports. A few addresses with hundreds of connections point to a connection flood:
ss -Htn state established '( sport = :80 or sport = :443 )' | awk '{print $4}' | sed 's/:[0-9]*$//' | sort | uniq -c | sort -n | tail
Check the load with uptime and the busiest processes with htop. If the server is calm but the network is saturated, the attack is volumetric and must be stopped upstream. Contact support.
Option 1: CSF connection limits (recommended)
If you run CSF, use its built-in limits instead of a separate script. In /etc/csf/csf.conf:
# Block an IP that holds more than 150 connections (checked every 30 seconds)
CT_LIMIT = "150"
CT_INTERVAL = "30"
CT_PORTS = "80,443"
# Limit concurrent connections per IP for each port
CONNLIMIT = "22;5,80;50,443;50"
# Limit new connections per IP over time (port;proto;hits;seconds)
PORTFLOOD = "80;tcp;100;5,443;tcp;100;5"
Restart CSF with csf -r. Start with generous values and lower them if needed: visitors behind a shared office or mobile network can open many connections from one address. Do not set the limits too low on sites behind Cloudflare, because all traffic arrives from Cloudflare’s addresses.
Option 2: DDoS-Deflate
DDoS-Deflate is a small shell script that runs every minute, counts connections per IP address, and blocks addresses over a limit for a set time, using iptables, CSF or APF. The maintained version is the jgmdev/ddos-deflate project on GitHub. Its settings are in /etc/ddos/ddos.conf, mainly the connection limit, the ban period and an ignore list for your own addresses.
If you use it, download it from the project page, read the install script before you run it as root, and add your own IP addresses and monitoring services to the ignore list. Do not run it together with CSF connection limits; choose one.
Option 3: protect the website itself
- Cache pages so most requests never reach PHP. A cached page costs the server almost nothing.
- Rate-limit login and search pages, which attackers target because they are expensive to serve.
- Use Cloudflare or a similar service in front of the site. It absorbs floods and can challenge suspicious visitors. See our Cloudflare and cPanel guide.
- Use a web application firewall such as ModSecurity to block abusive request patterns.
On Nginx, a simple rate limit for a login page looks like this:
limit_req_zone $binary_remote_addr zone=login:10m rate=5r/m;
location = /wp-login.php {
limit_req zone=login burst=5 nodelay;
# ...your usual PHP settings
}
Option 4: network-level protection
Large attacks must be filtered before they reach your server. Several UnderHost products include DDoS protection at the network level; check the product page of your plan for what is included, or ask support. During an attack, open a ticket with the time, the target IP address and what you see, so the network team can act.
During an attack: a short checklist
- Confirm the attack: connection counts, load, and network graphs.
- Contact support with the details, especially if the network is saturated.
- Turn on Cloudflare’s Under Attack mode if the site is behind Cloudflare.
- Block the worst source addresses in the firewall, and tighten rate limits on the targeted pages.
- Keep notes and logs, so you can tune your protection afterwards.
Need help with this?
Need protection that holds up under attack? Talk to us about DDoS-protected servers and managed firewall setup.
Frequently asked questions
Can DDoS-Deflate stop a DDoS attack?
Only small ones from a few addresses. Large floods fill the network link before the server can block anything.
Should I use DDoS-Deflate or CSF?
If you already run CSF, use its CT_LIMIT, CONNLIMIT and PORTFLOOD settings. Do not run both.
Does Cloudflare protect against DDoS attacks?
Yes, for traffic to websites that go through Cloudflare’s proxy. It does not protect other services such as SSH or email on the server.
Can connection limits block real visitors?
Yes, if they are too strict. Many visitors can share one IP address, for example on mobile networks. Start with generous limits.
What should I send support during an attack?
The affected IP address, the time the attack started, and what you observe, such as connection counts or error messages.
Related guides
- Automating cPanel Backups: Off-Site Options and Safer Methods
- How to Configure ModSecurity in cPanel for Advanced Security
- Node.js Security Update (October 2026): CVE-2026-111497
- Joomla Hosting: Optimized Solutions for a Faster, Safer, and Scalable Website
- PHP Critical Security Update (October 2026): Patch Guide, CloudLinux Status, CERT-EU Advice and Mitigations
