The upstream_dynamic module can be modifies the upstream server without need of restarting nginx.
This module is still under early development and is still experimental.
http {
resolver 127.0.0.1:5353;
server {
listen 8080;
server_name localhost;
location / {
proxy_pass http://upstest;
}
}
server {
listen 8081;
server_name localhost;
location /http_upstream_conf/ {
allow 127.0.0.1;
deny all;
http_upstream_conf;
}
}
upstream upstest {
zone ups_dyn 3m;
server_resolver;
server www.test.com:8081;
}
}
syntax: server_resolver
default: no
context: upstream
Specify this upstream server will be monitors changes of the IP addresses that correspond to a domain name of the server, and automatically modifies the upstream.
In order for this parameter to work, the resolver
directive must be specified in the http block.
syntax: http_upstream_conf
default: no
context: location
Turns on the REST API is used to modify upstream server in the surrounding location. Access to this location should be limited.
Supported methods:
-
list
list the specified upstream's server.
-
add
add the server to the upstream.
-
down
down the specified upstream's server.
Consider the following example:
http://127.0.0.1:8081/http_upstream_conf/list?ups=upstest
http://127.0.0.1:8081/http_upstream_conf/add?ups=upstest&ip=1.1.1.1
http://127.0.0.1:8081/http_upstream_conf/down?ups=upstest&ip=1.1.1.1
directives stream_upstream_conf
modify the upstream server of stream block.
wenqiang li(vislee)
This module is licensed under the BSD license.
Copyright (C) 2018, by vislee.
All rights reserved.