Apache 将 host:port/dir 重定向到另一个主机:port/dir



我想将一些请求重定向到另一台服务器。每个对 http://host:port/dir 的请求都应该重定向到 http://anotherhost:port/dir。我已经尝试使用ProxyPass/ProxyPassReverse,RewriteCond/RewriteRule等,但没有任何效果。

有人可以帮我吗?提前谢谢你

问候

解决了!首先要做的是侦听端口,即:例如,如果我们试图做的是重定向到 http://anotherhost:8080/dir 来自 http://host:8080/dir 的每个请求,我们应该侦听端口 8080,因此,下一行必须在 httpd.conf 中。

Listen 8080

然后,我们需要配置代理:

ProxyRequests On
ProxyPass /dir http://anotherhost:8080/dir
ProxyPassReverse /dir http://anotherhost:8080/dir

我希望这可以帮助某人

问候

相关内容

最新更新