Module ngx_http_map_module

nginx


english
עברית
日本語
русский
türkçe

news

about
download
security advisories
documentation
introduction
pgp keys
howto
faq
trac
wiki
links
books
support
donation
nginx.com
@nginxorg
Example Configuration
Directives
     map
     map_hash_bucket_size
     map_hash_max_size

The ngx_http_map_module module creates variables whose values depend on values of other variables.

Example Configuration

map $http_host $name {
    hostnames;

    default       0;

    example.com   1;
    *.example.com 1;
    example.org   2;
    *.example.org 2;
    .example.net  3;
    wap.*         4;
}

Directives

syntax: map $variable1 $variable2 { ... }
default:
context: http

Creates a variable whose value depends on the value of another variable. The directive supports three special parameters:

default value
sets a value for the second variable when the value of the first variable cannot be found.
hostnames
allows to specify hostnames with a prefix or suffix mask, as source values, for example,
*.example.com 1;
example.*     1;
The following two records
example.com   1;
*.example.com 1;
can be combined:
.example.com  1;
include file
includes a file with values. There can be several inclusions.

syntax: map_hash_bucket_size size;
default:
map_hash_bucket_size 32|64|128;
context: http

Sets the bucket size for the map variables hash tables. Default value depends on the size of the processor's cache line. For more information, please refer to Setting Up Hashes.

syntax: map_hash_max_size size;
default:
map_hash_max_size 2048;
context: http

Sets the maximum size of the map variables hash tables. For more information, please refer to Setting Up Hashes.