Block And Deny IP Address OR Network Subnets with Nginx

Nginx comes with a module called ngx_http_access_module that allows you to allow or deny access to IP address.

Simply open your nginx.conf and add to the server block:

allow my.ip.address;
deny all;

or

deny bad.ip.address;
allow all;
VN:F [1.9.22_1171]
Rating: 5.0/5 (2 votes cast)
Block And Deny IP Address OR Network Subnets with Nginx, 5.0 out of 5 based on 2 ratings

2 Responses to Block And Deny IP Address OR Network Subnets with Nginx

  1. This is cool!

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>