ProxyPass | ProxyPassMatch在位置中定义时不能有路径

时间:2016-10-04 11:52:43

标签: apache configuration proxypass

我在这个问题上尝试了答案。 How to merge multiple ProxyPass directives in Apache?  但是当我开始apache说ProxyPass|ProxyPassMatch can not have a path when defined in a location.

时,我收到了一个错误

我的000-default.conf下面是代码

<VirtualHost *:80>
include location1.conf
include location2.conf
</VirtualHost>

和我的location1有,

<Location /web/?_escaped_fragment_=/>
ProxyPass        /phpmyadmin !
ProxyPass / http://localhost:8082/
ProxyPassReverse / http://localhost:8082/
</Location>

和我的location2有,

<Location /web/#!/>
ProxyPass        /phpmyadmin !
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</Location>

1 个答案:

答案 0 :(得分:1)

与您提到的问题中可以看到的类似,当嵌套在ProxyPass子句下时,有必要删除ProxyPassReverse<Location>子句的第一个参数/强>

因此,请考虑改变您的配置:

<强> LOCATION1

<Location /web/?_escaped_fragment_=/>
    ProxyPass /phpmyadmin !
    ProxyPass http://localhost:8082/          # <== Dropped '/'
    ProxyPassReverse http://localhost:8082/   # <== Dropped '/'
</Location>

<强> LOCATION2

<Location /web/#!/>
    ProxyPass /phpmyadmin !
    ProxyPass http://localhost:8080/          # <== Dropped '/'
    ProxyPassReverse http://localhost:8080/   # <== Dropped '/'
</Location>

这应该可以正常工作。