-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
63 lines (48 loc) · 1.66 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
# vi: ft=nginx
events {
worker_connections 1024;
}
worker_processes 4;
error_log stderr;
http {
resolver 127.0.0.11 ipv6=off;
include mime.types;
lua_package_path "/usr/local/openresty/lualib/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?.lua;/lua/src/?.lua";
lua_package_cpath "/usr/local/openresty/lualib/?.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;";
# you must provide a shared memory space for caching
lua_shared_dict cache_dict 1m;
lua_shared_dict metrics_dict 1m;
# just to precompile the luajit source: https://www.youtube.com/watch?v=EP7c0BM2yNo
init_by_lua_block { require("controller") }
# spawning the pollers
init_worker_by_lua_block { require("controller").run() }
# hooking up all the phases (on http context)
rewrite_by_lua_block { require("controller").run() }
access_by_lua_block { require("controller").run() }
header_filter_by_lua_block { require("controller").run() }
body_filter_by_lua_block { require("controller").run() }
log_by_lua_block { require("controller").run() }
# this server won't run any plugin (it was skipped per general.skip_domains)
server {
listen 5050;
server_name metrics.server.local.com;
location / {
default_type application/json;
content_by_lua_block { require("controller").render_metrics() }
}
}
server {
listen 6060;
server_name dynamic.local.com;
location / {
content_by_lua_block { require("controller").run() }
}
}
server {
listen 7070;
server_name clock.local.com;
location / {
content_by_lua_block { ngx.say("hello world, right now is " .. ngx.time()) }
}
}
}