Install haproxyInstall SoftwareThe installation of haproxy is performed using the following commands: Translations Ignore |
---|
Code Block |
---|
| apt-get -y install haproxy
|
Code Block |
---|
| mv /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.sample |
|
The second command renames the installed configuration, as this is not required. Acticate haproxyActivate the haproxy service with the following command: Translations Ignore |
---|
Code Block |
---|
| systemctl enable haproxy.service |
|
Configure the firewall with the following commands: Translations Ignore |
---|
Code Block |
---|
| ufw allow 80/tcp
ufw allow 443/tcp
ufw allow 7777/tcp |
|
Configure the firewall with the following commands: Translations Ignore |
---|
Code Block |
---|
| ufw allow in on eth1 to any port 80 proto tcp
ufw allow in on eth1 to any port 443 proto tcp
ufw allow in on eth1 to any port 7777 proto tcp |
|
haproxy Log Warning |
---|
These commands are not required on Debian 11.5 machines and later. Do not execute the following commands on those systems. |
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 Translations Ignore |
---|
Code Block |
---|
| 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 |
|
|