-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnginx.conf
44 lines (37 loc) · 909 Bytes
/
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
http {
init_worker_by_lua_block {
local consul_balancer = require "n4l.consul_balancer"
consul_balancer.watch("http://consul.service.consul:8500", {
"foo",
{name="bar", service="bar", tag="http"}
})
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location / {
index index.html;
}
location /somefoo {
proxy_pass http://upstream_foo;
}
location /somebar {
proxy_pass http://upstream_bar;
}
}
upstream upstream_foo {
server 127.0.0.1:666;
balancer_by_lua_block {
local consul_balancer = require "n4l.consul_balancer"
consul_balancer.round_robin("foo")
}
}
upstream upstream_bar {
server 127.0.0.1:666;
balancer_by_lua_block {
local consul_balancer = require "n4l.consul_balancer"
consul_balancer.round_robin("bar")
}
}
}