if ($query_string ~ ".*(?:^|\?|&)key=(.+?)(?:(?:&.*)|$)") {
set $key "$1";
} 

地址比如是:
http://www.a.com/index.html?key=123&method=256
则$key的值为123