- An EC2 machine was launched with linux ubuntu running in AWS console
-
Apache2 installed on the machine
#Enabling modules:
- sudo a2enmod rewrite
- sudo a2enmod proxy
- sudo a2enmod proxy_balancer
- sudo a2enmod proxy_http
- sudo a2enmod headers
- sudo a2enmod lbmethod_bytraffic
#Restarting apache2 service
- sudo systemctl restart apache2 #Ensuring Apache2 is running
- sudo systemctl status apache2
- Configuring Load Balancer and Registering Webservers to its configuration files
-
sudo vi /etc/apache2/sites-available/000-default.conf
-
#Adding the info to the configuration file
-
<Proxy "balancer://mycluster"> BalancerMember http://:80 loadfactor=5 timeout=1 BalancerMember http://:80 loadfactor=5 timeout=1 ProxySet lbmethod=bytraffic # ProxySet lbmethod=byrequests
ProxyPreserveHost On
ProxyPass / balancer://mycluster/
ProxyPassReverse / balancer://mycluster/
#Restart apache server
- sudo systemctl restart apache2