问题描述
我有一个非 Apache 服务器侦听端口 8001 和 Apache 侦听端口 80.我希望某个虚拟域实际上由非 Apache 服务器通过端口 80 提供服务.
I have a non-Apache server listening to port 8001 and Apache listening port 80. I want a certain virtual domain to actually be served by the non-Apache server over port 80.
示例:
<VirtualHost *:80>
Servername example.com
# Forward this on to the server on port 8001
</VirtualHost>
我想我可以用 mod_proxy 和 ProxyPass 用这样的东西来做到这一点.
I thought I could do this with mod_proxy and ProxyPass with something like this.
ProxyPass * http://www.example.com:8001/
但这不起作用.
推荐答案
star 只在一个区块中有效.正斜杠就是你想要的.
star is only valid in a block. Forward slash is what you want.
ProxyPass / http://www.example.com:8001/
ProxyPassReverse / http://www.example.com:8001/
反向代理确保将您的 8001 端口服务器发送的重定向调整为代理的规范名称.
The reverse proxy ensures that redirects sent by your port 8001 server are adjusted to the canonical name name of your proxy.
apache 手册有一些例子.http://httpd.apache.org/docs/2.0/mod/mod_proxy.html
The apache manual has some examples.http://httpd.apache.org/docs/2.0/mod/mod_proxy.html
这篇关于Apache 端口代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!