apche转发与负载均衡

        之前甲方一直将文件服务器与应用服务器放在同一apche下,现在将文件服务器与应用服务器分开了,一开始以为图片的上传以及文件的上传代码不能通过apche配置进行请求转发,需要后台进行请求转发。后来才知道可以在apche中的httpd.conf文件中进行请求转发,甚至进行服务器的负载均衡配置。

找到该文件

②NameVirtualHost *:80
ProxyPreserveHost On
<VirtualHost *:80>
    ProxyRequests Off

    ProxyPass /server-status !

    ProxyPass /socketserver http://127.0.0.1:7888

    ProxyPass /rest/file http://10.10.2.60:11080/rest/file
    ProxyPassReverse /rest/file http://10.10.2.60:11080/rest/file
    
    ProxyPass /rest/base/file http://10.10.2.60:11080/rest/base/file
    ProxyPassReverse /rest/base/file http://10.10.2.60:11080/rest/base/file

    ProxyPass /uploaded http://10.10.2.60:11080/uploaded
    ProxyPassReverse /uploaded http://10.10.2.60:11080/uploaded

        ProxyPass /rest/bo/Knowledge http://10.10.2.60:11080/rest/bo/Knowledge
    ProxyPassReverse /rest/bo/Knowledge http://10.10.2.60:11080/rest/bo/Knowledge

    ProxyPass /rest/base/file2 http://10.10.2.60:11080/rest/base/file2
    ProxyPassReverse /rest/base/file2 http://10.10.2.60:11080/rest/base/file2


    ProxyPass /rest/bo/CompPic http://10.10.2.60:11080/rest/bo/CompPic
    ProxyPassReverse /rest/bo/CompPic http://10.10.2.60:11080/rest/bo/CompPic
    
    
    ProxyPass / balancer://tomcatcluster/ lbmethod=byrequests stickysession=JSESSIONID nofailover=Off timeout=5 maxattempts=3
    ProxyPassReverse / balancer://tomcatcluster/

    <Proxy balancer://tomcatcluster>
        BalancerMember http://10.10.2.54:6080 route=tomcat2 loadfactor=1
        BalancerMember http://10.10.2.54:7080 route=tomcat2 loadfactor=1
        BalancerMember http://10.10.2.54:8080 route=tomcat2 loadfactor=1
        BalancerMember http://10.10.2.54:9080 route=tomcat2 loadfactor=1
    </Proxy>

</VirtualHost>

在该文件中进行转发以及负载均衡配置

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值