2014-08-30 64 views

回答

1

ProxyPass和ProxyPassReverse是需要配置为将Apache设置为反向代理的指令。根据需要

ProxyPass  /app1/ http://internal1.example.com/ 
ProxyPass  /app2/ http://internal2.example.com/ 

所以http://www.example.com/app1/some-path映射到http://internal1.example.com/some-path

简单来说“的ProxyPass”执行从外部到内部的单向地址空间转换为英寸

而ProxyPassReverse执行从应用程序/网页逆翻译-server响应于外部地址空间中:

ProxyPassReverse /app1/ http://internal1.example.com/ 
ProxyPassReverse /app2/ http://internal2.example.com/ 

这使得自参考/向其它内部服务器的引用不穿过原样只是要转换为外部地址空间中的情况下,重新定向例如:

HTTP/1.1 302 Found 
    Location: http://internal.example.com/foo/   
//ProxyPass lets this through to user browser as-is! 

与反向代理这个被返回给用户的浏览器

HTTP/1.1 302 Found 
    Location: http://www.example.com/foo/ 

使用ProxyPassReverse指令。