-
Notifications
You must be signed in to change notification settings - Fork 1
/
nginx.conf
55 lines (49 loc) · 1.37 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
user nobody;
worker_processes 4;
worker_rlimit_nofile 65536;
#
#...
#...
http {
lua_shared_dict blocked 10m;
# http config
#...
#...
server {
listen 80;
# flush logs to logger server by hand
location /_flush {
allow 127.0.0.1;
deny all;
# point to your local path
content_by_lua_file {path}/lualib/request/flush.lua;
}
# accept request, add ip to blacklist or remove
location = /_process_ip {
allow 127.0.0.1;
# add your hosts here
#allow 192.168.1.0/24;
deny all;
content_by_lua_block {
local process_ip = require "request.process_ip"
process_ip.process()
}
}
# your proctected location
location /yourlocation {
# set ip address to value
set $nginx_server_addr "192.168.1.123";
set $logger_host "192.168.1.123";
set $logger_port 5140;
# proxy config
# ...
# ...
# check request
# point to your local path
access_by_lua_file {path}/lualib/request/validate_ip.lua;
# send request content to log server
# point to your local path
log_by_lua_file {path}/lualib/request/log.lua;
}
}
}