Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Followings are another example of balancer configuration:

Code Block
<VirtualHost *:80>
        ServerName cdn.foo.net

        ProxyRequests   Off
        ProxyVia        Off
        ProxyPreserveHost       On

        <Proxy *>
                Require all granted
        </Proxy>

       <Proxy balancer://mycluster>
    #   WAS1
    BalancerMember http://192.168.10.7:80 route=1 connectiontimeout=1

      # WAS2
    BalancerMember http://192.168.10.8:80 route=2 connectiontimeout=1

           ProxySet lbmethod=byrequests
           ProxySet stickysession=ROUTEID
       </Proxy>
       ProxyPass               "/"     "balancer://mycluster"
       ProxyPassReverse        "/"     "balancer://mycluster"

        DocumentRoot "/pub/cdn.qsok.com/"
        CustomLog /var/log/httpd/cdn.its-newid.net-access.log combined
        ErrorLog /var/log/httpd/cdn.its-newid.net-error.log
</VirtualHost>


If you encounter errors like below in case that you use PHP combined with Apache, you will need to use other configuration. Probably you may not able to get any session data from your client.

Image Added

Below configuration will enable you to use your PHP codes as designed.

Code Block
<VirtualHost *:80>
        ServerName cdn.foo.net

        ProxyRequests   Off
        ProxyVia        Off
        ProxyPreserveHost       On

        <Proxy *>
                Require all granted
        </Proxy>

        ProxyPass       /balancer-manager       !
        ProxyPass       /       balancer://mycluster/   stickysession=BALANCEID nofailover=On
        ProxyPassReverse        /       http://192.168.10.7:80
        ProxyPassReverse        /       http://192.168.10.8:80
       <Proxy balancer://mycluster>
           BalancerMember http://192.168.10.7:80   route=1 connectiontimeout=1
           BalancerMember http://192.168.10.8:80   route=2 connectiontimeout=1
           ProxySet lbmethod=byrequests
       </Proxy>

        <Location /balancer-manager>
                SetHandler balancer-manager
                Order deny,allow
                Allow from all
        </Location>

        DocumentRoot "/pub/cdn.qsok.com/"
        CustomLog /var/log/httpd/cdn.its-newid.net-access.log combined
        ErrorLog /var/log/httpd/cdn.its-newid.net-error.log
</VirtualHost>