Skip to content

Instantly share code, notes, and snippets.

@anjia0532
anjia0532 / openresty
Last active September 5, 2017 07:36
openresty init.d script
#!/bin/sh
### BEGIN INIT INFO
# Provides: openresty
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts openresty
# Description: starts openresty using start-stop-daemon
### END INIT INFO
@anjia0532
anjia0532 / ip_blacklist.lua
Created May 24, 2017 15:10 — 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: