2022-08-10 13:18:33 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2023-10-02 10:05:15 +00:00
|
|
|
if [ "$(id -u)" -ne 0 ] ; then
|
2022-08-10 13:18:33 +00:00
|
|
|
echo "❌ Run me as root"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
DNF=$(which dnf)
|
|
|
|
|
APT=$(which apt)
|
|
|
|
|
|
2023-10-02 10:05:15 +00:00
|
|
|
if [ -n "$DNF" ] ; then
|
2022-08-10 13:18:33 +00:00
|
|
|
dnf install -y haproxy
|
2023-10-02 10:05:15 +00:00
|
|
|
elif [ -n "$APT" ] ; then
|
2022-08-10 13:18:33 +00:00
|
|
|
apt install -y haproxy
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
cp haproxy.cfg /etc/haproxy
|
2022-08-16 09:08:58 +00:00
|
|
|
sed -i "s/*:8080/*:80/" /etc/haproxy/haproxy.cfg
|
2024-12-29 12:57:47 +00:00
|
|
|
sed -i "s/bunkerweb/127.0.0.1/" /etc/haproxy/haproxy.cfg
|
2022-08-11 11:28:30 +00:00
|
|
|
systemctl stop bunkerweb
|
2022-08-10 13:18:33 +00:00
|
|
|
systemctl stop haproxy
|
2023-12-04 16:29:57 +00:00
|
|
|
if [ -f /lib/systemd/system/haproxy.service ] ; then
|
|
|
|
|
sed -i 's/^BindReadOnlyPaths/#BindReadOnlyPaths/' /lib/systemd/system/haproxy.service
|
|
|
|
|
systemctl daemon-reload
|
|
|
|
|
fi
|
2022-08-16 09:08:58 +00:00
|
|
|
systemctl start haproxy
|
2024-01-05 11:54:38 +00:00
|
|
|
# shellcheck disable=SC2181
|
2023-12-04 11:01:49 +00:00
|
|
|
if [ $? -ne 0 ] ; then
|
|
|
|
|
systemctl status haproxy
|
|
|
|
|
journalctl -u haproxy.service
|
|
|
|
|
fi
|
2022-08-10 13:18:33 +00:00
|
|
|
|
2023-09-29 17:11:48 +00:00
|
|
|
echo "hello" > /var/www/html/index.html
|