• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question IP Range Banning in Nginx.

Zardiw

Basic Pleskian
Hey....

Currently I am banning IP ranges/addresses using .htaccess.

The notation is really simple, in that I can ban an entire country easily.

For instance.

Deny 1. (Bans 1.0.0.0 to 1.255.255.255)
Deny 128. (Bans 128.0.0.0 to 128.255.255.255)

Or I can Deny a part of a range like

Deny 128.45. (Bans 128.45.0.0 to 128.45.255.255)

But apparently using this type of notation is only used in .htaccess files.

Everywhere else they use CIDR notation, which is a PITA to understand and find out exactly which IP range is being referred to.

So to ban IP ranges in Nginx, you have to create a file (something like bannedips.list) which contains
lines like:

Deny --- IP Range --
Deny --- IP Range --

And refer to that file in the nginx.conf file thusly by adding these lines to it:

## Listen banned IP addresses via bannedips.list ##
include bannedips.list;

If I use the .htaccess notation in that file.....i.e 44. to ban the entire 44. IP range......
will that work?

Or do I have to do something like 44.0.0.0/some number

Thanks

PS. Is there a way to add tags after you post a thread?

z
 
Thank you for the response.......I will try that out.....
What is the notation to deny say 14. ?

Also, I have a LOT of banned IP ranges........small sample:

Deny from 1.
Deny from 14.
Deny from 27.
Deny from 31.
Deny from 37.
Deny from 41.
Deny from 42.
# Deny from 46. SiteUpTime Phillipines
Deny from 49.
# Deny from 50.
Deny from 59.
Deny from 60.
Deny from 62.
# Deny from 77. Germany/England
Deny from 79.
Deny from 80.
Deny from 82.
Deny from 83.
# Deny from 84. # Germany.
# Deny from 86. Netherlands User
Deny from 87.
Deny from 88.
Deny from 89.
Deny from 91.
Deny from 92.
Deny from 93.
Deny from 95.

z
 
Back
Top