Nginx configuration refuses or allows IP

  
 

nginx rejects or allows the specified IP, using the module HTTP access control module (HTTP Access). The control rules are checked in the order in which they are declared, and the first access rule that matches the IP is enabled.
location /{ deny 192.168.1.1; allow 192.168.1.0/24; allow 10.1.1.0/16; deny all;}

The above example only allows 192.168.1.0/24 and 10.1.1.0/16 networks The segment accesses this location field, but 192.168.1.1 is an exception. Pay attention to the order in which the rules are matched. If you have used apache, you may think that you can control the order of the rules at will and they can work normally, but they can't. The following example will reject all connections:
location /{ #This will always output a 403 error. Deny all; # These instructions will not be enabled because the connection reached has been rejected in the first line deny 192.168.1.1; allow 192.168.1.0/24; allow 10.1.1.0/1}

Copyright © Windows knowledge All Rights Reserved