This question has been asked several times but none of the answers works for me. This is very simple, I want to block some IP access to a server
I tried this:
.htaccess
Order Deny,Allow Deny from 151.101.52.84
iptables -L
Chain INPUT (policy ACCEPT) target prot opt source destination DROP all -- 151.101.52.0/24 anywhere REJECT tcp -- 151.101.52.84 anywhere tcp reject-with icmp-port-unreachable DROP all -- 151.101.52.84 anywhere DROP all -- 151.101.52.84 anywhere DROP tcp -- 151.101.52.84 anywhere ACCEPT tcp -- anywhere anywhere tcp dpt:http limit: avg 100/min burst 200
/etc/hosts.deny
ALL : 151.101.52.84
netstat -te | grep 151.101
tcp 0 1 ip-*-*-*-*.us-we:51181 151.101.52.84:http SYN_SENT apache 800352623
Already restarted httpd
Even I blocked the IP via Amazon EC2 VPC
Need to restart entire server? Need something else with iptables?
allow
/deny
any more. Use something like<RequireAll>
/Require all granted
/Require not ip 1.2.3.4
/</RequireAll>
instead. See also httpd.apache.org/docs/2.4/howto/access.html – Quasimodo's clone