Skip to content

Instantly share code, notes, and snippets.

View mylxsw's full-sized avatar
🎯
Focusing

管宜尧 mylxsw

🎯
Focusing
View GitHub Profile
@mylxsw
mylxsw / ip_blacklist.lua
Last active October 22, 2019 11:52 — forked from Ceelog/cloudSettings
nginx ip blacklist using redis, add password support
-- 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 ngx_ip_blacklist 10.1.1.1
-- remove an ip: