Set Limit connections per IP

Hello. After some time fails with task of setting limitations of incoming connections to 443 port. Now asking for community. I have more than 1000 connections from scrappers, web crawlers, etc. at same time.

I’d like to Drop more than 5 connections at ones from 1 IP

I’ve tried to do that with iptables rule written from /usr/local/hestia/data/firewall/custom.sh

#!/bin/bash
iptables -A INPUT -p tcp --syn --dport 443 -m connlimit --connlimit-above 5 --connlimit-mask 32 -j REJECT --reject-with tcp-reset

No affect after restarting iptables

Also tried to write nginx rule by this instruction https://trendoceans.com/limit-number-of-connections-in-nginx/
in file /home/admin/conf/web/my.domain/nginx.ssl.conf

But it was no success.
Would be appreciated for help or suggestion.