Example:

One use for this would be to use a mapping in place of writing lots of server/location directives or redirects:

指令

syntax:*map $var1 $var2 { … }*

default:*none*

context:*http*

  • hostnames — it allows for an easier matching of values like host names, names with a starting dot may match exact host names and host names ending with the value, for example:

Instead of two entries

we can use only one

  • include — include values from a file. Multiple includes may be used.

    map_hash_max_size

syntax:*map_hash_max_size number*

default:*map_hash_max_size 2048*

context:*http*

syntax:*map_hash_bucket_size n*

default:*map_hash_bucket_size 32/64/128*

context:*http*

The directive sets the maximum size in a hash table to map variables. The default value depends on the size of the cache line processor. More see in the descriptions of hash settings in the .

References