Skip to content

Instantly share code, notes, and snippets.

Avatar

congcong xiaochongchong86

View GitHub Profile
@xiaochongchong86
xiaochongchong86 / ip_blacklist.lua
Created Oct 15, 2019 — forked from chrisboulton/ip_blacklist.lua
Redis based IP blacklist for Nginx (LUA)
View ip_blacklist.lua
-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ip_blacklist 10.1.1.1
-- remove an ip: