Security 5 min read

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.

By BashPilot Team
BashEdge WAF & DDoS protection Stop Layer 7 floods and malicious requests before they reach the app. Explore BashEdge

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.

connections per source address on the web ports
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.

requests per domain in the next 10 seconds, busiest first
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.

what the flood looks like on the target domain
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. 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. 2

    Ban the worst addresses at the firewall

    For a short list, iptables -I INPUT -s ADDRESS -j DROP works immediately. For hundreds, load them into an ipset so the firewall makes one lookup instead of walking a long chain.

  3. 3

    Let Fail2Ban handle repeat offenders

    Plesk's Fail2Ban jails, including plesk-modsecurity, ban sources that keep tripping rules. Check /var/log/fail2ban.log to 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. 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.

/etc/nginx/conf.d/ratelimit.conf (http level)
limit_req_zone $binary_remote_addr zone=perip:10m rate=5r/s;
Additional nginx directives for the attacked domain
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

load, connections and the request rate together
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.

Share LinkedIn X
Questions

Frequently asked questions

Where are the per-domain logs on a Plesk server?

Plesk keeps them under `/var/www/vhosts/system/DOMAIN/logs/`. The HTTPS access log is `access_ssl_log`, and when nginx proxies to Apache the nginx side is `proxy_access_ssl_log`. The base directory can be changed during setup, so confirm the path with `ls` on your server.

Does Plesk have built-in DDoS protection?

Plesk includes a firewall, Fail2Ban and ModSecurity, which together block known bad sources and malicious requests. None of them is designed to absorb a large distributed flood of ordinary-looking requests, which needs rate limiting and, for big attacks, filtering before the traffic reaches the server.

Can Fail2Ban stop a DDoS on Plesk?

It helps against a small number of persistent sources, because it bans addresses after repeated matches. It struggles with floods spread across many addresses, since each one may never cross the threshold. Plesk's `plesk-modsecurity` jail bans IPs that ModSecurity flags, even in detection-only mode.

Where do I add rate limits for one domain in Plesk?

The rate limit zone has to be defined at nginx's http level, for example in a file under `/etc/nginx/conf.d/`. You can then apply `limit_req` to a path in the domain's Additional nginx directives under Apache & nginx Settings. Test with `nginx -t` before reloading.

Should I restart nginx or Apache during an attack?

Restarting rarely helps. It drops every current connection, real visitors reconnect at the same moment as the flood, and the attack continues. Use a reload after a configuration change, and spend the time finding and limiting the targeted path instead.

Put your servers on autopilot.

Connect a server in about a minute. The first week is on us.