Skip to content

Instantly share code, notes, and snippets.

View xiaochongchong86's full-sized avatar

congcong xiaochongchong86

View GitHub Profile
@xiaochongchong86
xiaochongchong86 / ip_blacklist.lua
Created October 15, 2019 12:51 — forked from chrisboulton/ip_blacklist.lua
Redis based IP blacklist for Nginx (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: