I got the following nginx settings:
upstream myUpstream{
server myHost:myPort;
}
location /test {
proxy_pass http://myUpstream/;
}
And I need all requests addressing nginxHost/test to be mapped to myHost:myPort/ without trailing /test
For example:
http://nginxHost/test/test1
I want to be redirected to
http://myHost:myPort/test1
But currently I get the following result:
http://myHost:myPort/test/test1
I tried to use rewrite (smth like that) –
location /test {
rewrite ^/test /(.*) /$1 break;
proxy_pass http://myUpstream/;
}
But that didnt work (obviousely I dont understand the concept of numered params: $1, $2 etc). Any help?