W3cubDocs

/nginx

Module ngx_http_keyval_module

The ngx_http_keyval_module module (1.13.3) creates variables with values taken from key-value pairs managed by the API.

This module is available as part of our commercial subscription.

Example Configuration

http {

    keyval_zone zone=one:32k state=one.keyval;
    keyval $arg_text $text zone=one;
    ...
    server {
        ...
        location / {
            return 200 $text;
        }

        location /api {
            api write=on;
        }
    }
}

Directives

Syntax: keyval key $variable zone=name;
Default:
Context: http

Creates a new $variable whose value is looked up by the key in the key-value database. Strings are matched ignoring the case. The database is stored in a shared memory zone specified by the zone parameter.

Syntax: keyval_zone zone=name:size [state=file];
Default:
Context: http

Sets the name and size of the shared memory zone that keeps the key-value database. Key-value pairs are managed by the API.

The optional state parameter specifies a file that keeps the current state of the key-value database in the JSON format and makes it persistent across nginx restarts.

© 2002-2017 Igor Sysoev
© 2011-2017 Nginx, Inc.
Licensed under the BSD License.
https://nginx.org/en/docs/http/ngx_http_keyval_module.html