URL

Whitelist IP in NGINX for URL

If you want to whitelist IP for just one URL (e.g /accounts/login) then add the above allow directive in location block of that URL.
location /accounts/login {
allow 45.43.23.21;
deny all;
}

Restart NGINX

Run the following command to check syntax of your updated config file.
$ sudo nginx -t
If there are no errors, run the following command to restart NGINX server.
$ sudo service nginx reload #debian/ubuntu
$ systemctl restart nginx #redhat/centos
Last modified 10mo ago