Reputation: 4997
I am looking to deny a particular IP from Nginx for all the locations under a server configuration.
e.g.
server {
listen 443;
server_name localhost;
location / {
root /data/www;
deny 127.0.0.1;
}
location /images/ {
root /data;
deny 127.0.0.1;
}
}
In this approach, I will have to provide deny or allow for each location. Is it possible to do this at server level, which would apply to all locations?
Upvotes: 0
Views: 2626
Reputation: 790
As the Nginx docs point out, the deny rules can be applied to the entire server configuration:
Syntax: allow address | CIDR | unix: | all;
Default: —
Context: http, server, location, limit_except
Upvotes: 4