Kimly Vith
Kimly Vith

Reputation: 53

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.

Upvotes: 1

Views: 557

Answers (2)

Saiprasad Bane
Saiprasad Bane

Reputation: 487

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.

Upvotes: 1

covener
covener

Reputation: 17872

You just need a basic reverse proxy configuration. The absolute basics are loading mod_proxy, mod_proxy_http, and using ProxyPass to match the URL's you want to pass to the backend system.

Upvotes: 0

Related Questions