我有一个非Apache Web服务器运行在端口8000上,但是这不能从企业防火墙后面访问。 所以,我想用我的apache 2服务器作为这个其他web服务器的代理。 我试过使用:
RewriteEngine On RewriteRule /.* http://buildbot.synergy-foss.org:8000/builders/ [PT]
…但这是行不通的。 我得到:
错误的请求
您的浏览器发送了此服务器无法理解的请求。
但是,它与[R]一起工作得很好。
另外,当使用ProxyPass ,我得到这个错误:
被禁止
您无权访问/在此服务器上。
我不会推荐使用mod_rewrite代理,除非你有一个原因; mod_rewrite可能会更强大,但它听起来像你不需要它..例如,它听起来像你只是想要以下内容:
# Does't disable ProxyPass; but will disable everything you're not using ProxyPass off # Always setup a reverse proxy so that Apache can rewrite the URL ProxyPass / http://buildbot.synergy-foss.org:8000/builders/ ProxyPassReverse / http://buildbot.synergy-foss.org:8000/builders/
确保你启用mod_proxy( 文档在这里 )。 祝你好运!
你想要[P]标志,而不是[PT] 。 重写规则中的[PT]表示“通过”,允许其他处理程序( Alias , Redirect等)处理。
你也可以用mod_proxy获得相同的结果,从类似如下的开始:
ProxyPass / http://buildbot.synergy-foss.org:8000/builders/