nginx重写无法获取整个url

nginx重写无法获取整个url,nginx,redirect,url-rewriting,Nginx,Redirect,Url Rewriting,我正在尝试为以下情况实现nginx重写规则:请求 /config manager/getConfig?applicationId=tweetcasterandV2.xml应重定向到 /myPath/tweetcasterandV2.xml 我已经为我的服务器设置了rewrite_登录,并创建了以下规则: location /config-manager { rewrite ^/config-manager/getConfig?applicationId=(.*)$ /myP

我正在尝试为以下情况实现nginx重写规则:请求

/config manager/getConfig?applicationId=tweetcasterandV2.xml
应重定向到

/myPath/tweetcasterandV2.xml

我已经为我的服务器设置了rewrite_登录,并创建了以下规则:

    location /config-manager {
      rewrite ^/config-manager/getConfig?applicationId=(.*)$  /myPath/$1  last;
    }

    location /myPath
    {
      root   /usr/share/nginx/html/myPath;
      index  index.html index.htm;
    }
但当我做这个请求时,我从服务器上得到404NotFound错误。错误日志包含以下内容:

root@60ade49e127b:/var/log/nginx# cat host.error.log
2020/10/24 00:20:58 [notice] 15#15: *1 "^/config-manager/getConfig?applicationId=(.*)$" does not match "/config-manager/getConfig", client: 172.17.0.1, server: localhost, request: "GET /config-manager/getConfig?applicationId=tweetcasterandV2.xml HTTP/1.1", host: "localhost:8080"
2020/10/24 00:20:58 [error] 15#15: *1 open() "/etc/nginx/html/config-manager/getConfig" failed (2: No such file or directory), client: 172.17.0.1, server: localhost, request: "GET /config-manager/getConfig?applicationId=tweetcasterandV2.xml HTTP/1.1", host: "localhost:8080"
root@60ade49e127b:/var/log/nginx#
就像“重写”只是得到一个部分字符串,却无法匹配?我已经看过教程,这是应该工作。是否需要为nginx设置一个特殊参数来传递整个URL进行重写


谢谢。

查询字符串不是使用
location
rewrite
指令测试的主题,它们与不包含查询字符串的规范化URI一起工作。但是你可以做一些像

位置/配置管理器{
重写^/myPath/$arg_applicationId last;
}

您还可以查看答案。

请参阅@DerektheDevOpsguy StackOverflow,这是一种感谢所述答案的方式:)