0

I'm trying to set up two Apache ProxyPass rules to direct to different Nexus servers. What I want is:

http://mainserver/nexus -> http://server1:8080/nexus

and

http://mainserver/nexus-pro -> http://server2:8081/nexus

I had it set up to work with our original server, but adding a second rule causes requests for nexus-pro to redirect to the main apache server with /nexus, which then forwards on to the wrong server, thus:

http://mainserver/nexus-pro -> http://mainserver/nexus -> http://server1:8080/nexus

I imagine this is something Nexus is doing itself, but I'm not really in control of that.

Here is my current Apache config, what do I need to change?

ProxyPass /nexus http://server1:8080/nexus
ProxyPassReverse /nexus http://server1:8080/nexus

ProxyPass /nexus-pro http://server2:8081/nexus
ProxyPassReverse /nexus-pro http://server2:8081/nexus

ProxyPreserveHost On
4

2 回答 2

1

在给定的部分中,Apache httpd 配置按照它们在配置中出现的顺序进行处理。如果您转置这两个定义,则更明确的 /nexus-pro 将覆盖 /nexus 定义。

ProxyPass /nexus-pro http://server2:8081/nexus
ProxyPassReverse /nexus-pro http://server2:8081/nexus

ProxyPass /nexus http://server1:8080/nexus
ProxyPassReverse /nexus http://server1:8080/nexus

ProxyPreserveHost On

阅读http://httpd.apache.org/docs/current/sections.html#merging了解更多信息。

于 2014-03-03T17:29:07.493 回答
0

您可以尝试以下两行进行测试:

ProxyPass /example-ip http://www.toolsvoid.com/what-is-my-ip-address
ProxyPassReverse /example-ip http://www.toolsvoid.com/what-is-my-ip-address

ProxyPass /example http://www.example.com/
ProxyPassReverse /example http://www.example.com/
于 2014-03-20T13:09:07.263 回答