configuring multiple domains using virtual host with mod proxy in a single httpd instance

后端 未结 2 604
长发绾君心
长发绾君心 2021-01-28 10:38

I have an apache instance running three domains using name based virtual hosting and every domain has resources to reverse proxy them down to an application server. Application

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-28 11:25

    Create Three different Name-based VirtualHost and disable context(alpha and beta) in www.ghi.com.

    
    ServerName abc.com
    Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/alpha" env=BALANCER_ROUTE_CHANGED
    
    
    order Allow,Deny
    Deny from all
    
    BalancerMember http://x.x.x.x:8080 route=1 retry=0
    BalancerMember http://x.x.x.x:8081 route=2 retry=0
    ProxySet stickysession=ROUTEID
    
    ProxyPass /alpha balancer://mycluster4/alpha
    ProxyPassReverse /alpha balancer://mycluster4/alpha
    
    
    
    ServerName def.com
    Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/beta" env=BALANCER_ROUTE_CHANGED
    
    
    order Allow,Deny
    Deny from all
    
    BalancerMember http://x.x.x.x:8080 route=1 retry=0
    BalancerMember http://x.x.x.x:8081 route=2 retry=0
    ProxySet stickysession=ROUTEID
    
    ProxyPass /beta balancer://mycluster4/beta
    ProxyPassReverse /beta balancer://mycluster4/beta
    
    
    
    ServerName ghi.com
    Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
    
    
    order Allow,Deny
    Deny from all
    
    BalancerMember http://x.x.x.x:8080 route=1 retry=0
    BalancerMember http://x.x.x.x:8081 route=2 retry=0
    ProxySet stickysession=ROUTEID
    
    ProxyPass /alpha !
    ProxyPass /beta !
    ProxyPass / balancer://mycluster4/
    ProxyPassReverse / balancer://mycluster4/
    
    

提交回复
热议问题