Using cPanel IP Blocker

  • Log in to cPanel
  • Go to Security -> IP Blocker
  • Enter the IP address or range to block
  • Click Add
  • Supported formats:

    • Single IP: 1.2.3.4
    • Range: 1.2.3.0/24
    • Wildcard: 1.2.3.*

    Block via .htaccess

    Add to /public_html/.htaccess: Order Allow,Deny Deny from 1.2.3.4 Allow from all

    Block on VPS (UFW)

    ufw deny from 1.2.3.4 to any ufw reload

    Find Malicious IPs

    Check access logs for frequent IPs: awk '{print $1}' /home/USER/logs/yourdomain.com-bytes_log | sort | uniq -c | sort -rn | head -20

    Use abuseipdb.com to check if an IP is known for abuse.