@@ -1608,13 +1608,35 @@ fi
16081608# Get public IP
16091609pub_ip=$( curl --ipv4 -s https://ip.hestiacp.com/)
16101610if [ ! -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
16161618fi
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
16191641if [ " $mysql " = ' yes' ]; then
16201642 $HESTIA /bin/v-add-database-host mysql localhost root $mpass
0 commit comments