I already add new UFW rule, but why it’s not working? The answer because UFW is working by number order. So if you made a new rule, that mean the rule is latest rule, it have a chance latest rule will be denying because the previous rule allowed it

My Mess UFW Setup
- Check UFW list using
ufw status numbered
- In my example, I want to block IP 185.143.xxx.xxx (number 12) but the position was under the 80 & 143 (number 9 & 10) rule. First we remove rule 12,
ufw delete 12
- Then insert, make it first rule or at least above the 80 & 443 rule
ufw insert 1 deny from 185.143.xxx.xxx
To check the rule working or not, you can check that if that IP still can access your website at access.log
in nginx/apache log or you can check /var/log/ufw.log
file