|
|
@@ -1608,13 +1608,35 @@ fi
|
|
|
# Get public IP
|
|
|
pub_ip=$(curl --ipv4 -s https://ip.hestiacp.com/)
|
|
|
if [ ! -z "$pub_ip" ] && [ "$pub_ip" != "$ip" ]; then
|
|
|
- sed -i '/exit 0/d' /etc/rc.local
|
|
|
+ if [ -e /etc/rc.local ]; then
|
|
|
+ sed -i '/exit 0/d' /etc/rc.local
|
|
|
+ fi
|
|
|
echo "$HESTIA/bin/v-update-sys-ip" >> /etc/rc.local
|
|
|
echo "exit 0" >> /etc/rc.local
|
|
|
$HESTIA/bin/v-change-sys-ip-nat $ip $pub_ip > /dev/null 2>&1
|
|
|
ip=$pub_ip
|
|
|
fi
|
|
|
|
|
|
+# Configuring libapache2-mod-remoteip
|
|
|
+if [ "$apache" = 'yes' ] && [ "$nginx" = 'yes' ] ; then
|
|
|
+ cd /etc/apache2/mods-available
|
|
|
+ echo "<IfModule mod_remoteip.c>" > remoteip.conf
|
|
|
+ echo " RemoteIPHeader X-Real-IP" >> remoteip.conf
|
|
|
+ if [ "$local_ip" != "127.0.0.1" ] && [ "$pub_ip" != "127.0.0.1" ]; then
|
|
|
+ echo " RemoteIPInternalProxy 127.0.0.1" >> remoteip.conf
|
|
|
+ fi
|
|
|
+ if [ ! -z "$local_ip" ] && [ "$local_ip" != "$pub_ip" ]; then
|
|
|
+ echo " RemoteIPInternalProxy $local_ip" >> remoteip.conf
|
|
|
+ fi
|
|
|
+ if [ ! -z "$pub_ip" ]; then
|
|
|
+ echo " RemoteIPInternalProxy $pub_ip" >> remoteip.conf
|
|
|
+ fi
|
|
|
+ echo "</IfModule>" >> remoteip.conf
|
|
|
+ sed -i "s/LogFormat \"%h/LogFormat \"%a/g" /etc/apache2/apache2.conf
|
|
|
+ a2enmod remoteip >> $LOG
|
|
|
+ systemctl restart apache2
|
|
|
+fi
|
|
|
+
|
|
|
# Configuring MariaDB host
|
|
|
if [ "$mysql" = 'yes' ]; then
|
|
|
$HESTIA/bin/v-add-database-host mysql localhost root $mpass
|