Nginx is a very unique Web Server, today I will show how to deny IP using Nginx, Please note you must have this module installed in your Nginx web server , If you don’t have it installed – Simply download my pre-compile Nginx which comes with all the necessary modules known to NGINX.
Will create a file under our conf directory lets called that block.conf, My conf directory is located at /etc/nginx/conf.d/.
We are going to assume YOUR IP Address i.e. 220.127.116.11 & 18.104.22.168
nano /etc/nginx/conf.d/block.conf deny 22.214.171.124; deny 126.96.36.199; deny 188.8.131.52;
Once done restart your Nginx server
service nginx restart OR service nginx reload
Great source to obtain fresh IP addresses is from Ip2location
You pick and choose any country from the above link and wont allow them access to your server.