将我重定向到:[port] / [无论我输入什么]

时间:2017-08-09 16:19:14

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

我在localhost:8080上运行了一个应用,我配置了Nginix以使其在localhost/上运行

我在localhost:3000

上运行了另一个应用

我想要做的是在我最初访问localhost:3000/[whatever]时将我重定向到localhost/[whatever]

我想做类似的事情:

location /[SOMETHING] {
    proxy_pass http://localhost:3000/[THAT_SAME_THING_ABOVE];
}

是否可以配置Nginx来执行此操作?如果是这样的话? 感谢

PS::8080上运行的应用是一个页面,因此:8080/[whatever]现在甚至不存在

1 个答案:

答案 0 :(得分:0)

这是解决方案,以防有人需要它

location = / {
    proxy_pass http://localhost:8080
}

location / {
    proxy_pass http://localhost:3000
}