performance - move external blacklists checks from nginx to LUA

This commit is contained in:
bunkerity
2021-05-10 17:51:07 +02:00
parent 009d6fb5ae
commit fd61df205f
14 changed files with 141 additions and 38 deletions

View File

@@ -0,0 +1,21 @@
init_by_lua_block {
local dataloader = require "dataloader"
local use_proxies = %USE_PROXIES%
local use_abusers = %USE_ABUSERS%
local use_tor_exit_nodes = %USE_TOR_EXIT_NODES%
if use_proxies then
dataloader.load_ip("/etc/nginx/proxies.list", ngx.shared.proxies_data)
end
if use_abusers then
dataloader.load_ip("/etc/nginx/abusers.list", ngx.shared.abusers_data)
end
if use_tor_exit_nodes then
dataloader.load_ip("/etc/nginx/tor-exit-nodes.list", ngx.shared.tor_exit_nodes_data)
end
}

View File

@@ -94,6 +94,15 @@ http {
# shared memory zone for limit_conn
%LIMIT_CONN_ZONE%
# shared memory zone for proxies
%BLOCK_PROXIES%
# shared memory zone for abusers
%BLOCK_ABUSERS%
# shared memory zone for TOR exit nodes
%BLOCK_TOR_EXIT_NODES%
# whitelist or blacklist country
%USE_COUNTRY%
@@ -109,6 +118,9 @@ http {
# custom http confs
include /http-confs/*.conf;
# LUA init block
include /etc/nginx/init-lua.conf;
# default server when MULTISITE=yes
%MULTISITE_DEFAULT_SERVER%