Maintenance mode for all but my ip
Jonathan Matthews
contact at jpluscplusm.com
Sat Dec 7 15:10:08 UTC 2013
On 7 December 2013 14:58, B.R. <reallfqq-nginx at yahoo.fr> wrote:
> I am new to the use of maps, but I suppose it would fit perfectly, using
> core variables such as the binary IP address:
[snip]
> rewrite ^.*$ $target #Redirecting all traffic according to map-assigned
I don't particularly like ^^^ this. It seems like a level of
indirection too far ;-)
Using /almost/ the same technique, you could have a map based on the
remote IP like BR suggested, but use it like this:
http {
map $remote_addr $not_me {
default 1;
my.ip.address "";
}
server {
# whatever else you need
location / {
if ($not_me) {
return 503
}
}
}
}
Cheers,
Jonathan
More information about the nginx
mailing list