apachedevopsapplication-serverdatabase-server

how to config apache point to another index in different server?


I am configuring 3 tiers setup(webserver, database server, and application server). I want to separate everything into 3 three servers. I have already separated between the application server and the database server. Regarding to webserver and application server, I don't know how to config apache to point to my application server. I tried to share file and folder from application server to webserver already with samba share, but it still did not work. The problem is apache server can access the resource in the other server(application server).

If you everyone used to solved or faced this problem. Could you please help me?

Thank in advance.


Solution

  • As a part of an old assignment I had achieved something similar using below config.

    <VirtualHost *:80>
    
            ProxyPreserveHost On
            ProxyRequests Off
            <Proxy "balancer://mycluster">
                            BalancerMember "http://10.0.0.1:8001"
                            BalancerMember "http://10.0.0.1:8002"
                            BalancerMember "http://10.0.0.1:8003"
                            BalancerMember "http://10.0.0.1:8004"
                            BalancerMember "http://10.0.0.1:8005"
                            BalancerMember "http://10.0.0.1:8006"
                            ProxySet lbmethod=byrequests
            </Proxy>
            ProxyPass / "balancer://mycluster/" stickysession=BALANCEID
            ProxyPassReverse / "balancer://mycluster/"
    </VirtualHost>
    

    For your case, I feel changing your Virtual Host as below must do the magic.

    <VirtualHost *:80>
    
            ProxyPreserveHost On
            ProxyRequests Off
            <Proxy "balancer://mycluster">
                            BalancerMember "http://192.168.2.35:8000"
                            ProxySet lbmethod=byrequests
            </Proxy>
            ProxyPass / "balancer://mycluster/" stickysession=BALANCEID
            ProxyPassReverse / "balancer://mycluster/"
    </VirtualHost>
    

    Also ensure that you enable the lbmethod_byrequests_module in your apache.