[Nginx] Access restriction configuration to block specific IP addresses
Tadashi Shigeoka · Sat, March 17, 2018
I configured access restrictions in Nginx to block specific IP addresses, so I’ll introduce how to write the conf file.
Background for wanting to block IP addresses
The service went down due to attacks from specific IP addresses.
By the way, when I checked with the whois command, it was a Chinese IP address.
Nginx IP address deny configuration
Just add deny IP address; inside the directive you want to refuse.
location / {
deny xxx.xxx.xxx.xxx;
}
That’s all from the Gemba where I wanted to refuse access only from specific IP addresses.