Skip to content

Commit 6565b49

Browse files
author
Kristan Kenney
committed
Merge branch 'dev-1204-kk'
2 parents 0dd6819 + 0ffe68a commit 6565b49

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

install/hst-install-ubuntu.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1608,13 +1608,35 @@ fi
16081608
# Get public IP
16091609
pub_ip=$(curl --ipv4 -s https://ip.hestiacp.com/)
16101610
if [ ! -z "$pub_ip" ] && [ "$pub_ip" != "$ip" ]; then
1611-
sed -i '/exit 0/d' /etc/rc.local
1611+
if [ -e /etc/rc.local ]; then
1612+
sed -i '/exit 0/d' /etc/rc.local
1613+
fi
16121614
echo "$HESTIA/bin/v-update-sys-ip" >> /etc/rc.local
16131615
echo "exit 0" >> /etc/rc.local
16141616
$HESTIA/bin/v-change-sys-ip-nat $ip $pub_ip > /dev/null 2>&1
16151617
ip=$pub_ip
16161618
fi
16171619

1620+
# Configuring libapache2-mod-remoteip
1621+
if [ "$apache" = 'yes' ] && [ "$nginx" = 'yes' ] ; then
1622+
cd /etc/apache2/mods-available
1623+
echo "<IfModule mod_remoteip.c>" > remoteip.conf
1624+
echo " RemoteIPHeader X-Real-IP" >> remoteip.conf
1625+
if [ "$local_ip" != "127.0.0.1" ] && [ "$pub_ip" != "127.0.0.1" ]; then
1626+
echo " RemoteIPInternalProxy 127.0.0.1" >> remoteip.conf
1627+
fi
1628+
if [ ! -z "$local_ip" ] && [ "$local_ip" != "$pub_ip" ]; then
1629+
echo " RemoteIPInternalProxy $local_ip" >> remoteip.conf
1630+
fi
1631+
if [ ! -z "$pub_ip" ]; then
1632+
echo " RemoteIPInternalProxy $pub_ip" >> remoteip.conf
1633+
fi
1634+
echo "</IfModule>" >> remoteip.conf
1635+
sed -i "s/LogFormat \"%h/LogFormat \"%a/g" /etc/apache2/apache2.conf
1636+
a2enmod remoteip >> $LOG
1637+
systemctl restart apache2
1638+
fi
1639+
16181640
# Configuring MariaDB host
16191641
if [ "$mysql" = 'yes' ]; then
16201642
$HESTIA/bin/v-add-database-host mysql localhost root $mpass

0 commit comments

Comments
 (0)