I know how to deny access to all websites but I want to know how to deny access to an IP to the website test.html using NGINX
Asked
Active
Viewed 1,160 times
2 Answers
2
You can define a location for an individual URI by using the location =
form.
location = /test.html {
allow 1.2.3.4;
deny all;
}
See this document for details.

Richard Smith
- 12,834
- 2
- 21
- 29
1
You need a location block in your config like this
location = /test.html {
deny 192.168.1.1; #define the IP you want to block here
allow all; #allow the rest
}
Nginx tests IP in order and accepts the first match, so in this case your denied IP will match the first entry and all others will match the allow all

Drifter104
- 3,773
- 2
- 25
- 39