0
我想重定向一些請求到另一臺服務器。對http://host:port/dir的每個請求都應重定向到http://anotherhost:port/dir。 我已經嘗試使用ProxyPass/ProxyPassReverse,RewriteCond/RewriteRule等,但沒有解決。Apache重定向主機:端口/目錄到另一個主機:端口/目錄
有人可以幫我嗎? 預先感謝您
問候
我想重定向一些請求到另一臺服務器。對http://host:port/dir的每個請求都應重定向到http://anotherhost:port/dir。 我已經嘗試使用ProxyPass/ProxyPassReverse,RewriteCond/RewriteRule等,但沒有解決。Apache重定向主機:端口/目錄到另一個主機:端口/目錄
有人可以幫我嗎? 預先感謝您
問候
解決了!第一件要做的就是聽端口,例如:如果我們試圖做的每一個請求都會被重定向到http://anotherhost:8080/dir,那麼我們應該監聽端口8080,因此,下一行必須在httpd.conf中。
Listen 8080
然後,我們需要配置代理:
ProxyRequests On
ProxyPass /dir http://anotherhost:8080/dir
ProxyPassReverse /dir http://anotherhost:8080/dir
我希望這能幫助別人
問候