-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnginx.conf
60 lines (46 loc) · 1.27 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
user nobody;
worker_processes 2;
error_log logs/error.log notice;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log logs/access.log main;
keepalive_timeout 65;
upstream my_object_backup {
server 10.0.1.11:8080;
server 10.0.1.12:8080;
server 10.0.1.13:8080;
}
upstream my_object{
server 0.0.0.1;
balancer_by_lua_block {
local balancer = require "ngx.balancer"
local ddkl = require "resty.ddkl"
local port = 8080
local app_name = "my_object"
local server = ddkl.get_server(app_name)
local ok,err = balancer.set_current_peer(server,port)
if not ok then
ngx.log(ngx.ERR,"failed to set current perr:",err)
end
}
}
server {
listen 8080;
server_name localhost;
location / {
proxy_connect_timeout 1;
access_by_lua '
local app_name = "my_object"
local ddkl_access = require "resty.ddkl_access"
ddkl_access = ddkl_access.core(app_name)
';
proxy_pass http://my_object;
proxy_next_upstream_tries 100;
}
}
}