While our example recipe allows for changes to be made on the fly, they aren't persistent if we reboot NGINX Plus. To ensure these changes are maintained between reboots, we can add a state file to manage the current configuration. This is done via updating the upstream block directive. Here's what our updated configuration looks like:
upstream localapp { zone backend 64k; state /var/lib/nginx/state/servers.state; }
We add the state directive, which is updated when there are any changes to the upstream configuration as well as being reread when NGINX restarts. All other server directives within that upstream must also be removed, as you can't combine static server configuration with a dynamic, stateful configuration. The state file itself is plain text (and uses the standard NGINX server directive format) but any direct manipulation of the file is strongly discouraged.