deny 192.168.1.1; # deny the actual IP address allow 127.0.0.1; # allow the actual IP address to access such as 127.0.0.1 for localhost allow 192.168.0.0/16; # allow IP addresses in range allow 172.16.0.0/16; allow 10.10.0.0/16; deny all; # deny the rest of the world
Include the IP whitelist to your app’s conf
/etc/nginx/conf.d/your.conf
1 2 3
server{ include /etc/nginx/conf.d/shared/ipwhitelist.conf }