Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.
/ HAProxy Public archive

How to config a HAProxy with e Apache servers

Notifications You must be signed in to change notification settings

Luismcplopes/HAProxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HAProxy

Github

- Configuração do (WebServers1) e virtualhost test.dev

sudo apt-get update && sudo apt-get upgrade -y

-Instalar apache2

sudo apt-get install apache2 -y

-Criar directório test.dev

sudo mkdir /var/www/html/test.dev

-Definir permissões

sudo chown -R $USER:$USER /var/www/html/test.dev && sudo chmod -R 755 /var/www

-Criar index.html

sudo vim /var/www/html/test.dev/index.html

-Criar um VirtualHost que aponte para test.dev

sudo nano /etc/apache2/sites-available/test.dev.conf

Restart no apache2

sudo apache2ctl configtest
sudo a2ensite test.dev.conf
 /etc/init.d/apache2 restart

Configuração do (webservers2) e virtualhost test.dev

sudo apt-get update && sudo apt-get upgrade -y

-Instalar apache2

sudo apt-get install apache2 -y

-Criar directório test.dev

sudo mkdir /var/www/html/test.dev

-Definir permissões

sudo chown -R $USER:$USER /var/www/html/test.dev && sudo chmod -R 755 /var/www

-Criar index.html

sudo vim /var/www/html/test.dev/index.html

-Criar um VirtualHost que aponte para test.dev

sudo nano /etc/apache2/sites-available/test.dev.conf

Restart no apache2

sudo apache2ctl configtest
sudo a2ensite test.dev.conf
 /etc/init.d/apache2 restart

-Instalar HAProxy

sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install haproxy

-Configurar HAProxy

-Adicionar ao ficheiro /etc/default/haproxy a linha:

ENABLED=1

-Ficheiro de configuração:

sudo cp /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg_bck
sudo rm /etc/haproxy/haproxy.cfg && sudo vim /etc/haproxy/haproxy.cfg

- Restart ao serviço

sudo service haproxy restart

Testar

Github

Teste Haproxy

http://192.168.1.6/test.dev/

Github Github

webserver1

http://192.168.1.10/test.dev/

Github

webserver2

http://192.168.1.8/test.dev/

Github

Estatisticas

admin:admin
http://192.168.1.6/haproxy?stats

Github

Mais Info

Releases

No releases published

Packages

 
 
 

Languages