Przeglądaj źródła

Fix: Configure unassinged web page after adding IP addr to Hestia

Robert Zollner 6 lat temu
rodzic
commit
f04b44a302
2 zmienionych plików z 44 dodań i 40 usunięć
  1. 22 20
      install/hst-install-debian.sh
  2. 22 20
      install/hst-install-ubuntu.sh

+ 22 - 20
install/hst-install-debian.sh

@@ -1147,14 +1147,6 @@ if [ "$nginx" = 'yes' ]; then
         check_result $? "php$fpm_v-fpm start failed"
     fi
 
-    # Redirect unassigned hosts to default "Success" page
-    for ip in /usr/local/hestia/data/ips/*; do
-        ipaddr=${ip##*/}
-        rm -f /etc/nginx/conf.d/$ip.conf
-        cp -f $HESTIA/install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ipaddr.conf
-        sed -i 's/directIP/'$ipaddr'/g' /etc/nginx/conf.d/$ipaddr.conf
-    done
-
     # Install dhparam.
     cp -f $HESTIA/install/deb/ssl/dhparam.pem /etc/ssl
 
@@ -1209,14 +1201,6 @@ if [ "$apache" = 'yes' ]; then
         fi
     fi
 
-    # Add unassigned hosts configuration to apache2
-    for ip in /usr/local/hestia/data/ips/*; do
-        ipaddr=${ip##*/}
-        rm -f /etc/apache2/conf.d/$ip.conf
-        cp -f $HESTIA/install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ipaddr.conf
-        sed -i 's/directIP/'$ipaddr'/g' /etc/apache2/conf.d/$ipaddr.conf
-    done
-
     update-rc.d apache2 defaults > /dev/null 2>&1
     service apache2 start >> $LOG
     check_result $? "apache2 start failed"
@@ -1678,6 +1662,22 @@ if [ ! -z "$pub_ip" ] && [ "$pub_ip" != "$ip" ]; then
     ip=$pub_ip
 fi
 
+# Add unassigned hosts configuration to webserver
+for ip in $(ls /usr/local/hestia/data/ips/ 2>/dev/null); do
+
+    if [ "$apache" = 'yes' ]; then
+        rm -f /etc/apache2/conf.d/$ip.conf
+        cp -f $HESTIA/install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ip.conf
+        sed -i 's/directIP/'$ip'/g' /etc/apache2/conf.d/$ip.conf
+    fi
+
+    if [ "$nginx" = 'yes' ]; then
+        rm -f /etc/nginx/conf.d/$ip.conf
+        cp -f $HESTIA/install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ip.conf
+        sed -i 's/directIP/'$ip'/g' /etc/nginx/conf.d/$ip.conf
+    fi
+done
+
 # Configuring libapache2-mod-remoteip
 if [ "$apache" = 'yes' ] && [ "$nginx"  = 'yes' ] ; then
     cd /etc/apache2/mods-available
@@ -1803,11 +1803,13 @@ cat $tmpfile
 rm -f $tmpfile
 
 echo "(!) IMPORTANT: You must logout or restart the server before continuing."
-echo -n " Do you want to logout now? [Y/N] "
-read resetshell
+if [ "$interactive" = 'yes' ]; then
+    echo -n " Do you want to logout now? [Y/N] "
+    read resetshell
 
-if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
-    logout
+    if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
+        logout
+    fi
 fi
 
 # EOF

+ 22 - 20
install/hst-install-ubuntu.sh

@@ -1115,14 +1115,6 @@ if [ "$nginx" = 'yes' ]; then
         check_result $? "php$fpm_v-fpm start failed"
     fi
 
-    # Redirect unassigned hosts to default "Success" page
-    for ip in /usr/local/hestia/data/ips/*; do
-        ipaddr=${ip##*/}
-        rm -f /etc/nginx/conf.d/$ip.conf
-        cp -f $HESTIA/install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ipaddr.conf
-        sed -i 's/directIP/'$ipaddr'/g' /etc/nginx/conf.d/$ipaddr.conf
-    done
-
     # Install dhparam.
     cp -f $HESTIA/install/deb/ssl/dhparam.pem /etc/ssl
 
@@ -1173,14 +1165,6 @@ if [ "$apache" = 'yes' ]; then
         chmod a+x $HESTIA/data/templates/web/apache2/*.sh
     fi
 
-    # Add unassigned hosts configuration to apache2
-    for ip in /usr/local/hestia/data/ips/*; do
-        ipaddr=${ip##*/}
-        rm -f /etc/apache2/conf.d/$ip.conf
-        cp -f $HESTIA/install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ipaddr.conf
-        sed -i 's/directIP/'$ipaddr'/g' /etc/apache2/conf.d/$ipaddr.conf
-    done
-
     update-rc.d apache2 defaults > /dev/null 2>&1
     service apache2 start >> $LOG
     check_result $? "apache2 start failed"
@@ -1605,6 +1589,22 @@ if [ ! -z "$pub_ip" ] && [ "$pub_ip" != "$ip" ]; then
     ip=$pub_ip
 fi
 
+# Add unassigned hosts configuration to webserver
+for ip in $(ls /usr/local/hestia/data/ips/ 2>/dev/null); do
+
+    if [ "$apache" = 'yes' ]; then
+        rm -f /etc/apache2/conf.d/$ip.conf
+        cp -f $HESTIA/install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ip.conf
+        sed -i 's/directIP/'$ip'/g' /etc/apache2/conf.d/$ip.conf
+    fi
+
+    if [ "$nginx" = 'yes' ]; then
+        rm -f /etc/nginx/conf.d/$ip.conf
+        cp -f $HESTIA/install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ip.conf
+        sed -i 's/directIP/'$ip'/g' /etc/nginx/conf.d/$ip.conf
+    fi
+done
+
 # Configuring MariaDB host
 if [ "$mysql" = 'yes' ]; then
     $HESTIA/bin/v-add-database-host mysql localhost root $mpass
@@ -1710,11 +1710,13 @@ cat $tmpfile
 rm -f $tmpfile
 
 echo "(!) IMPORTANT: You must logout or restart the server before continuing."
-echo -n " Do you want to logout now? [Y/N] "
-read resetshell
+if [ "$interactive" = 'yes' ]; then
+    echo -n " Do you want to logout now? [Y/N] "
+    read resetshell
 
-if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
-    logout
+    if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
+        logout
+    fi
 fi
 
 # EOF