-
Notifications
You must be signed in to change notification settings - Fork 11
/
nginx.conf
117 lines (92 loc) · 2.57 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#user root root;
worker_processes auto;
error_log logs/error.log;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
stream {
lua_package_path '/usr/local/ngdns-server/lualib/?.lua;/usr/local/ngdns-server/?.lua;;';
lua_package_cpath '/usr/local/ngdns-server/lualib/?.so;;';
lua_shared_dict QUERYCACHE 32m;
lua_shared_dict my_locks 1m;
ipdb qqwry.ipdb;
ipdb_language "CN";
init_by_lua_block {
local resty_lock = require "resty.lock"
local mlcache = require "resty.mlcache"
local cache, err = mlcache.new("my_cache_", "QUERYCACHE", {
lru_size = 100000,
ttl = 10,
neg_ttl = 1,
resty_lock_opts = resty_lock,
shm_locks = my_locks
})
_G.cache = cache
local tld = {
"aikaiyuan.com",
"sinacloud.com",
"abc.com",
}
local tlds = table.concat(tld, "|")
local zone = {
"(",
tlds,
")$"
}
_G.zone = table.concat(zone)
local DNSTYPES = {}
DNSTYPES[1] = "A"
DNSTYPES[2] = "NS"
DNSTYPES[5] = "CNAME"
DNSTYPES[6] = "SOA"
DNSTYPES[12] = "PTR"
DNSTYPES[15] = "MX"
DNSTYPES[16] = "TXT"
DNSTYPES[28] = "AAAA"
DNSTYPES[33] = "SRV"
DNSTYPES[99] = "SPF"
DNSTYPES[255] = "ANY"
_G.DNSTYPES = DNSTYPES
local views = {
电信 = "DX",
联通 = "LT",
移动 = "YD",
中华电信 = "DX",
鹏博士 = "PBS",
教育网 = "JY",
远传电信 = "DX",
广电网 = "DX",
亚太电信 = "DX",
长城 = "PBS"
}
_G.VIEWS = views
}
server {
listen 53 udp ;
lua_code_cache on;
content_by_lua_block {
local ngdns = require "53"
local new = ngdns:new({
redis_host = "127.0.0.1",
redis_port = 6379,
redis_timeout = 5,
})
new:run_udp()
}
}
server {
listen 53 ;
lua_code_cache on;
content_by_lua_block {
local ngdns = require "53"
local new = ngdns:new({
redis_host = "127.0.0.1",
redis_port = 6379,
redis_timeout = 5,
tcp = 1,
})
new:run_tcp()
}
}
}