=encoding utf-8 =head1 NAME ngx_http_upstream_conf_module - Module ngx_http_upstream_conf_module =head1 The C module allows configuring upstream server groups on-the-fly via a simple HTTP interface without the need of restarting nginx. The L or L server group must reside in the shared memory. B This module is available as part of our commercial subscription. =head1 Example Configuration upstream backend { zone upstream_backend 64k; ... } server { location /upstream_conf { upstream_conf; allow 127.0.0.1; deny all; } } =head1 Directives =head2 upstream_conf B I Turns on the HTTP interface of upstream configuration in the surrounding location. Access to this location should be L. Configuration commands can be used to: =over =item * view the group configuration; =item * view, modify, or remove a server; =item * add a new server. =back B Since addresses in a group are not required to be unique, specific servers in a group are referenced by their IDs. IDs are assigned automatically and shown when adding a new server or viewing the group configuration. A configuration command consists of parameters passed as request arguments, for example: http://127.0.0.1/upstream_conf?upstream=backend The following parameters are supported: =over =item C Selects a L upstream server group. Without this parameter, selects an L upstream server group. =item CI> Selects a group to work with. This parameter is mandatory. =item CI> Selects a server for viewing, modifying, or removing. =item C Removes a server from the group. =item C Adds a new server to the group. =item C Required to add a backup server. B Before version 1.7.2, C was also required to view, modify, or remove existing backup servers. =item CI> Same as the “C
” parameter of the L or L upstream server. When adding a server, it is possible to specify it as a domain name. In this case, changes of the IP addresses that correspond to a domain name will be monitored and automatically applied to the upstream configuration without the need of restarting nginx (1.7.2). This requires the “C” directive in the L or L block. See also the “C” parameter of the L or L upstream server. =item CI> Same as the “C” parameter of the L or L upstream server (1.9.13). =item CI> Same as the “C” parameter of the L or L upstream server. =item CI> Same as the “C” parameter of the L or L upstream server. =item CI> Same as the “C” parameter of the L or L upstream server. =item CI> Same as the “C” parameter of the L or L upstream server. =item CI> Same as the “C” parameter of the L or L upstream server. =item C Same as the “C” parameter of the L or L upstream server. =item C Puts the L upstream server into the “draining” mode (1.7.5). In this mode, only requests L to the server will be proxied to it. =item C The opposite of the “C” parameter of the L or L upstream server. =item CI> Same as the “C” parameter of the L upstream server. =back The first three parameters select an object. This can be either the whole http or stream upstream server group, or a specific server. Without other parameters, the configuration of the selected group or server is shown. For example, to view the configuration of the whole group, send: http://127.0.0.1/upstream_conf?upstream=backend To view the configuration of a specific server, also specify its ID: http://127.0.0.1/upstream_conf?upstream=backend&id=42 To add a new server, specify its address in the “C” parameter. Without other parameters specified, a server will be added with other parameters set to their default values (see the L or L “C” directive). For example, to add a new primary server, send: http://127.0.0.1/upstream_conf?add=&upstream=backend&server=127.0.0.1:8080 To add a new backup server, send: http://127.0.0.1/upstream_conf?add=&upstream=backend&backup=&server=127.0.0.1:8080 To add a new primary server, set its parameters to non-default values and mark it as “C”, send: http://127.0.0.1/upstream_conf?add=&upstream=backend&server=127.0.0.1:8080&weight=2&down= To remove a server, specify its ID: http://127.0.0.1/upstream_conf?remove=&upstream=backend&id=42 To mark an existing server as “C”, send: http://127.0.0.1/upstream_conf?upstream=backend&id=42&down= To modify the address of an existing server, send: http://127.0.0.1/upstream_conf?upstream=backend&id=42&server=192.0.2.3:8123 To modify other parameters of an existing server, send: http://127.0.0.1/upstream_conf?upstream=backend&id=42&max_fails=3&weight=4 The above examples are for an L upstream server group. Similar examples for a L upstream server group require the “C” parameter.