Apache中的mod_proxy模块具有代理的功能主要用于进行URL转发,此功能实现了通Jboss、Tomcat等应用服务器的整合,甚至还可以很方便的实现WEB集群的功能。
main-ssl.conf&httpd.conf
代理指令:
1. ProxyPass
语法:ProxyPass [path] !|url
例如:ProxyPass /test_portal https://192.168.0.1/test_portal
2. ProxyPassReverse 通常与ProxyPass配置成一样的
语法:ProxyPassReverse [path] url
例如:ProxyPass /test_portal https://192.168.0.1/test_portal
3. ProxyPassMatch
语法:ProxyPassMatch [regex] !|url
例如:
ProxyPassMatch ^/images ! 这个示例表示对/images的请求,都不会被转发。
ProxyPassMatch ^(/.*.gif)1 这个示例表示对所有gif图片的请求,都被会转到后端
架构图如下:
相关文件:main-ssl.conf&httpd.conf
脚本:
ProxyRequests Off
ProxyPreserveHost On
SSLProxyEngine On
SSLProxyCheckPeerCN off
ProxyPass /test_portal https://192.168.0.1/test_portal
ProxyPassReverse /test_portal https://192.168.0.1/test_portal
SSLEngine on