Install haproxy
Install Software
The installation of haproxy
is performed using the following commands:
apt-get -y install haproxy
mv /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.sample |
|
The second command renames the installed configuration, as this is not required.
Acticate haproxy
Activate the haproxy service with the following command:
systemctl enable haproxy.service |
|
Configure Firewall
Configure the firewall with the following commands:
ufw allow 80/tcp
ufw allow 443/tcp
ufw allow 7777/tcp |
|
haproxy Log
To allow the haproxy service to log to the syslog service, the following commands are executed.
The logs from haproxy will be in /var/log/haproxy.log
sed -i '/module(load="imudp")/s/^#//g' /etc/rsyslog.conf
sed -i '/input(type="imudp"/s/^#//g' /etc/rsyslog.conf
cat <<EOFF>/etc/rsyslog.d/haproxy.conf
local2.* /var/log/haproxy.log
& stop
EOFF
systemctl restart rsyslog |
|