How to whitelist IPs in NGINX configuration?

Add this code in your .conf file

if ($remote_addr = "14.51.20.3") {
  set $block_me_now "B";
}
 
 if ($remote_addr = "104.1.20.29") {
  set $block_me_now "B";
}

if ($block_me_now != "B") {
    return 403;
    break;
}

Posted

in

by

Comments

Leave a Reply

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