bunkerweb/examples/proxy-protocol/setup-linux.sh

30 lines
688 B
Bash
Raw Permalink Normal View History

2022-08-17 12:01:18 +00:00
#!/bin/bash
2023-10-02 10:05:15 +00:00
if [ "$(id -u)" -ne 0 ] ; then
2022-08-17 12:01:18 +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-17 12:01:18 +00:00
dnf install -y haproxy
2023-10-02 10:05:15 +00:00
elif [ -n "$APT" ] ; then
2022-08-17 12:01:18 +00:00
apt install -y haproxy
fi
cp haproxy.cfg /etc/haproxy
sed -i "s/*:8080/*:80/g" /etc/haproxy/haproxy.cfg
sed -i "s/*:8443/*:443/g" /etc/haproxy/haproxy.cfg
sed -i "s/bunkerweb/127.0.0.1/g" /etc/haproxy/haproxy.cfg
2022-08-17 12:01:18 +00:00
systemctl stop bunkerweb
systemctl stop haproxy
if [ -f /lib/systemd/system/haproxy.service ] ; then
sed -i 's/^BindReadOnlyPaths/#BindReadOnlyPaths/' /lib/systemd/system/haproxy.service
systemctl daemon-reload
fi
2022-08-17 12:01:18 +00:00
systemctl start haproxy
2022-11-11 13:55:04 +00:00
echo "hello" > /var/www/html/index.html