NGINX deny IP wildcard?

I currently deny IP addresses like this in the nginx.conf file:

deny 42.22.11.531;

But how would I deny

deny 42.22.*.*; <---- this obviously doesnt work, what is the correct syntax for nginx?

Ive seen:

deny 42.22.11.0/24 <---- not sure what this means, but it made me try

deny 42.22.0/999.0/999 <---- which fails.

So whats the correct syntax?


This isn't nginx specific, it's a lack of understanding subnets in network math; /24 is a class C and /16 is a class B.

42.22.*.* = 42.22.0.0/16 = 42.22.0.0/255.255.0.0

Bookmark: http://www.subnet-calculator.com


deny 42.22.11.0/16 is the correct syntax.

More information on nginx blocking

/16 signifies Subnetwork. For further information click on the link to read.