mod proxy html模块,Apache Mod_proxy 模块

笪成周
2023-12-01

编译安装启用Proxy模块:

tar httpd-2.2.15.tar.gz

cd httpd-2.2.15

./configure --prefix=/usr/local/apache --enable-proxy --enable-proxy-connect --enable-proxy-http --enable-proxy-balancer

make –j 2

make install

修改Apache主配置文件:

# 检查有没编译进去proxy相关的模块:/usr/local/apache/bin/apachectl -l

# 在配置文件最后加入:vim /usr/local/apache/conf/httpd.conf

ProxyRequests Off

ProxyPass / balancer://cluster

BalancerMember loadfactor=1 route=jvm1

BalancerMember loadfactor=9 route=jvm2

其它配置示例:

1:将指定子目录分配不同的Server端:

ProxyRequests Off

proxypass /news

proxypass /it

2:会话保持 (session_stick):

ProxyRequests Off

ProxyPass /test   balancer://cluster stickysession=jsessionid nofailover=On

BalancerMember loadfactor=1

BalancerMember loadfactor=1

3:按流量分配负载并指定热备:

ProxyRequests Off

ProxyPass /test   balancer://cluster

BalancerMember loadfactor=1

BalancerMember loadfactor=1

BalancerMember loadfactor=1 status=+H

ProxySet lbmethod=bytraffic

4:状态查看,需编译mod_status模块:

ProxyRequests Off

ProxyPass /test   balancer://cluster stickysession=jsessionid nofailover=On

BalancerMember loadfactor=1

BalancerMember loadfactor=1

SetHandler balancer-manager

Order Deny,Allow

Deny from all

Allow from 192.168.*

 类似资料: