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

后端 未结 2 603
长发绾君心
长发绾君心 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.

    <VirtualHost www.abc.com>
    ServerName abc.com
    Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/alpha" env=BALANCER_ROUTE_CHANGED
    <Proxy balancer://mycluster1>
    <LimitExcept POST GET>
    order Allow,Deny
    Deny from all
    </LimitExcept>
    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
    </Proxy>
    ProxyPass /alpha balancer://mycluster4/alpha
    ProxyPassReverse /alpha balancer://mycluster4/alpha
    </VirtualHost>
    
    <VirtualHost www.def.com>
    ServerName def.com
    Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/beta" env=BALANCER_ROUTE_CHANGED
    <Proxy balancer://mycluster1>
    <LimitExcept POST GET>
    order Allow,Deny
    Deny from all
    </LimitExcept>
    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
    </Proxy>
    ProxyPass /beta balancer://mycluster4/beta
    ProxyPassReverse /beta balancer://mycluster4/beta
    </VirtualHost>
    
    <VirtualHost www.ghi.com>
    ServerName ghi.com
    Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
    <Proxy balancer://mycluster1>
    <LimitExcept POST GET>
    order Allow,Deny
    Deny from all
    </LimitExcept>
    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
    </Proxy>
    ProxyPass /alpha !
    ProxyPass /beta !
    ProxyPass / balancer://mycluster4/
    ProxyPassReverse / balancer://mycluster4/
    </VirtualHost>
    
    0 讨论(0)
  • 2021-01-28 11:41

    Use the below sequence and test.

    ProxyPass /alpha !
    ProxyPass /gamma balancer://mycluster4/gamma
    ProxyPassReverse /gamma balancer://mycluster4/gamma
    ProxyPass / balancer://mycluster4/
    ProxyPassReverse / balancer://mycluster4/
    
    0 讨论(0)
提交回复
热议问题