How to block specific IPs with nginx


#1

Dear Group,

How do I create a block list?. I tried DENY but that does not work well
and
looks like it is only for blocking access to specific folders.

Please advise

regards

Asif A.


#2

maybe

deny xxx.xxx.xxx.xxx;
allow all;


#3

“deny” should work in every context, according to:
http://wiki.codemongers.com/NginxHttpAccessModule#deny

If you have only achieved denying access to specific folders, this is
because you are placing the directives within a location block.
Instead,
move it up to the server block or the http block (to block on all
servers).