Install haproxy
Install Software
The installation of haproxy
is performed using the following commands:
dnf -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:
firewall-cmd --zone=public --add-port=80/tcp --permanent firewall-cmd --zone=public --add-port=443/tcp --permanent firewall-cmd --zone=public --add-port=7777/tcp --permanent firewall-cmd --reload
SeLinux Configuration
Enable haproxy to open any port with the following selinux command:
setsebool -P haproxy_connect_any=1 semanage permissive -a haproxy_t
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/messages
sed -i -e 's/#$ModLoad *imudp/$ModLoad imudp/' -e 's/#$UDPServerRun *514/$UDPServerRun 514/' /etc/rsyslog.conf cat <<EOFF>/etc/rsyslog.d/haproxy.conf local2.* /var/log/haproxy.log EOFF service rsyslog restart