At least three servers are required:
Server A: Control Server
Server B and server C: actual execution Server
Server Load balancer principle: distribute requests from server A to server B and server C
Modify the http. conf file of apache on server:
First,Load the corresponding proxy module and remove the # sign before the following module:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Add at the end of the file:
ProxyPass/example/balancer: // proxy/
<Proxy balancer: // proxy>
BalancerMember http: // serverB/example/
BalancerMember http: // serverC/example/
</Proxy>
Distribute all files in the http: // serverA/example/subdirectory of server A to server B and server C for execution, which is equivalent to accessing http: // serverB/example/or http: // files in the serverC/example/subdirectory.
If written:
ProxyPass/balancer: // proxy/
<Proxy balancer: // proxy>
BalancerMember http: // serverB/
BalancerMember http: // serverC/
</Proxy>
It indicates that all requests to access A are converted to access B or C
Restart apache of server