建发浅水湾别墅:apache?ProxyPass?ProxyPassReverse概述
来源:百度文库 编辑:中财网 时间:2024/05/15 00:01:47
apache ProxyPass ProxyPassReverse概述
更多更详细的关于mod_proxy的描述可以参见手册:
http://lamp.linux.gov.cn/Apache/ApacheMenu/mod/mod_proxy.html
(一).ProxyPass 指令
说明: 将一个远端服务器映射到本地服务器的URL空间中
语法: ProxyPass [路径] !|url
上下文: 服务器配置, 虚拟主机
状态: Extension
模块: mod_proxy
指令对于您不想对某个子目录进行反向代理时很有用。比如说:
ProxyPass /mirror/foo/i !
ProxyPass /mirror/foo http://foo.com/
将会代理除对/mirror/foo/i请求之外的所有对 foo.com 的/mirror/foo请求。
注意:顺序很重要,您需要把特例情况放在一般代理通过指令
当在
如果您需要一个更加灵活的反向代理配置,请参见使用[P]标记的RewriteRule指令。
(二).ProxyPassReverse 指令
说明: 调整由反向代理服务器发送的HTTP回应头中的URL
语法: ProxyPassReverse [路径] url
上下文: 服务器配置, 虚拟主机
状态: Extension
模块: mod_proxy
此指令使 Apache 调整HTTP重定向回应中Location, Content-Location和URI头里的URL。 HTTP redirect responses. This is essential when Apache is used as a reverse proxy to avoid by-passing the reverse proxy because of HTTP redirects on the backend servers which stay behind the reverse proxy.
路径是本地虚拟路径的名称。
url远端服务器的部分URL。与ProxyPass指令中的使用方法相同。
示例:
假定本地服务器拥有地址http://wibble.org/;那么
ProxyPass /mirror/foo/ http://foo.com/
ProxyPassReverse /mirror/foo/ http://foo.com/
will not only cause a local request for the
Note that this ProxyPassReverse directive can also be used in conjunction with the proxy pass-through feature ("RewriteRule ... [P]") from mod_rewrite because its doesn't depend on a corresponding ProxyPass directive.
When used inside a
(三).实际问题解决及说明:
①
ProxyPass /path_wapm/
②ProxyPassReverse /path_wapm/
那么,访问http://wapm/服务器/path_wapm的时候,实际访问的将自动转换为了
http://192.168.8.11:81/path_iis/的.
③path_wapm如果不加,就不知道访问哪一个虚拟目录的时候需要使用ASP,
path_iis不加,那么就是访问http://192.168.8.11:81/的效果了
简单来说:就是把IIS站点的一个目录,当作WAPM的一个虚拟目录来访问,
可以是IIS站点的一个子目录,也可以是根目录.