L77
Syntax: | map |
---|---|
Default: | — |
Context: | http |
map 指令
curl -H 'aaaa:4444444' -H 'Host:map.taohui.org.cn' http://192.168.0.51:10001
map $http_host $name {
hostnames; default ; ~map\.tao\w+\.org.cn ;
*.taohui.org.cn ;
map.taohui.tech ;
map.taohui.* ;
} map $http_user_agent $mobile {
default ;
"~Opera Mini" ;
} server {
listen ;
default_type text/plain;
location /{
return '$name:$mobile\n';
}
}
类似编程语言的switch case
map $http_user_agent $mobile {#这个含义就是 当$http_user_agent 值 = "~Opera Mini" 那么我们就将 $mobile值设置为 1 否则就设置为 0
default ;
"~Opera Mini" ;
}
Syntax: | map_hash_bucket_size |
---|---|
Default: |
map_hash_bucket_size 32|64|128; |
Context: | http |
Syntax: | map_hash_max_size |
---|---|
Default: |
map_hash_max_size 2048; |
Context: | http |