With map it depends what your testing for and when a test is positive what you want to be in the mapped variable, for example;
map $http_user_agent $mobile {
default 0;
"~Opera Mini" 1;
}
If the $http_user_agent contains the string portion "*Opera Mini*" then $mobile will be set to the value 1.
Later on in a location block you can use $mobile and do something based on its value.
I think you first should think about what you want to test for with map and what kind of result you want to store in a variable and then think how you want to use this variable in a location block.
Even if you write some code nginx isn't accepting, because you wrote it down, we can think of a way how it should work.
map $http_user_agent $mobile {
default 0;
"~Opera Mini" 1;
}
If the $http_user_agent contains the string portion "*Opera Mini*" then $mobile will be set to the value 1.
Later on in a location block you can use $mobile and do something based on its value.
I think you first should think about what you want to test for with map and what kind of result you want to store in a variable and then think how you want to use this variable in a location block.
Even if you write some code nginx isn't accepting, because you wrote it down, we can think of a way how it should work.