Plesk Server Under DDoS: Find the Target and Block It
When a Plesk server slows to a crawl, one subscription is usually the target. Plesk's per-domain logs will tell you which one within minutes.
A Plesk server under a DDoS attack looks like every other overloaded server: high load, PHP workers stuck, every site slow. On a shared Plesk box the urgent question is which subscription is the target, because until you know that, every customer suffers. Plesk keeps separate logs per domain, so the answer is usually a few commands away.
Confirm it is a flood, not a slow site
Start with connections per source address. A few addresses holding hundreds of connections, or thousands of addresses each sending a little, both point at an attack. A server with high load and normal connection counts is more likely a slow query or a runaway script.
ss -Hnt state established '( sport = :80 or sport = :443 )' | awk '{print $4}' | sed 's/:[0-9]*$//' | sort | uniq -c | sort -rn | head -20
Find the subscription being hit
Plesk's support documentation lists each domain's HTTPS access log at /var/www/vhosts/system/DOMAIN/logs/access_ssl_log, and, when nginx proxies to Apache, the nginx side as proxy_access_ssl_log in the same folder. Compare how fast each one is growing.
cd /var/www/vhosts/system
count() { for d in */; do f="${d}logs/proxy_access_ssl_log"; [ -f "$f" ] && echo "${d%/} $(wc -l < "$f")"; done | sort; }
count > /tmp/before; sleep 10; count > /tmp/after
join /tmp/before /tmp/after | awk '{print $3-$2, $1}' | sort -rn | head -10
This counts how many requests each domain's log gained in ten seconds. One domain with a number far above the rest is your target. If your server has no nginx in front, run the same loop on access_ssl_log instead. The logs path is the default, and Plesk notes it can differ if the vhosts directory was moved, so check with ls first.
L=/var/www/vhosts/system/example.com/logs/proxy_access_ssl_log
tail -n 20000 "$L" | awk '{print $7}' | sort | uniq -c | sort -rn | head -10
tail -n 20000 "$L" | awk -F'"' '{print $6}' | sort | uniq -c | sort -rn | head -5
The first command shows the most requested paths, the second the most common user agents. Thousands of POSTs to /wp-login.php or /xmlrpc.php, or endless requests for a search URL with random terms, from many addresses with near-identical user agents, is a Layer 7 flood. A real traffic spike spreads across many pages and referrers.
Block it in the right place
-
1
Rate limit the targeted path in nginx
A request rate limit needs a zone defined at the http level, which Plesk's per-domain directives cannot hold. Put the zone in a file under
/etc/nginx/conf.d/, then apply it to the attacked path in the domain's Additional nginx directives under Apache & nginx Settings. -
2
Ban the worst addresses at the firewall
For a short list,
iptables -I INPUT -s ADDRESS -j DROPworks immediately. For hundreds, load them into an ipset so the firewall makes one lookup instead of walking a long chain. -
3
Let Fail2Ban handle repeat offenders
Plesk's Fail2Ban jails, including
plesk-modsecurity, ban sources that keep tripping rules. Check/var/log/fail2ban.logto see which jail banned what. If Imunify360 is installed, Plesk support notes it is not compatible with Fail2Ban, so use one or the other. -
4
Move it upstream if bandwidth is saturated
If the server's network link is full, no rule on the server helps. The traffic has to be filtered before it arrives, by your provider or a proxy in front.
limit_req_zone $binary_remote_addr zone=perip:10m rate=5r/s;
location = /wp-login.php {
limit_req zone=perip burst=10 nodelay;
limit_req_status 429;
proxy_pass https://127.0.0.1:7081;
}
Prove the server recovered
watch -n 5 'uptime; ss -Hnt state established "( sport = :80 or sport = :443 )" | wc -l; tail -n 2000 /var/www/vhosts/system/example.com/logs/proxy_access_ssl_log | grep -c " 429 "'
Load should fall back toward normal within a few minutes, the connection count should stop climbing, and the count of 429 responses shows the rate limit doing its work. If load stays high after the target is under control, look for a second, smaller target. Attackers sometimes probe several domains.
Prepare before the next one
- Keep a modest rate limit on login and search paths for every site, not only the one that was attacked. Those are the expensive endpoints attackers aim at.
- Make sure the nginx proxy log is enabled for every domain, so the per-domain comparison works the moment you need it.
- Alert on load and established connections, so you hear about an attack from a monitor rather than from customers.
- Know in advance who can filter traffic upstream for you, and how to ask, because a bandwidth flood cannot be fixed on the server.
When manual blocking is not enough
The steps above work, and they are the same steps every time a different customer gets targeted, usually at an inconvenient hour. BashEdge for Plesk is built for that situation. It protects every subscription across the nginx, Apache and application request path, detects high-rate clients, coordinated campaigns and distributed scanning, and has a Lockdown Mode for one targeted site or the whole server that holds automation back while real browsers continue. It starts in monitor mode, so you can review what it would have done before it blocks anything.
The same triage on other panels is covered in cPanel Server Under DDoS: Find the Vhost and Block It and DirectAdmin Server Under DDoS.