Skip to content

Commit a65bc29

Browse files
author
Kristan Kenney
committed
Configure Apache Remote IP module during installation on Ubuntu
1 parent 0dd6819 commit a65bc29

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

install/hst-install-ubuntu.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,6 +1615,26 @@ if [ ! -z "$pub_ip" ] && [ "$pub_ip" != "$ip" ]; then
16151615
ip=$pub_ip
16161616
fi
16171617

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

0 commit comments

Comments
 (0)