如何在nginx cofig文件中处理正则表达式中的问号

时间:2018-05-13 18:24:47

标签: nginx nginx-location nginx-reverse-proxy

我是nginx环境的新手。我可以知道如何处理nginx中URL的问号,参数和值 以下是nginx配置文件收到的请求 http://example.com/api/student?id=123
http://example.com/api/student?name=yuva1
http://example.com/api/student?place=KLhttp://example.com/api/student?marks=56

“=”(等于)符号后的值可以是任何值。 id可能会得到456,名称可能会收到jam5等, 让我知道如何在nginx配置文件中处理这个问题。感谢您的帮助。

感谢。

1 个答案:

答案 0 :(得分:0)

Nginx嵌入变量将提供参数的值。

例如,

http://example.com/api/student?id=123

$ arg_id = 123

  

$ arg_name

argument name in the request line 

来源:http://nginx.org/en/docs/http/ngx_http_core_module.html#variables