Преглед изворни кода

Fix: Move webserver config for unassigned domains to v-add-sys-ip from installer

Robert Zollner пре 6 година
родитељ
комит
cff710ecde
4 измењених фајлова са 13 додато и 40 уклоњено
  1. 10 2
      bin/v-add-sys-ip
  2. 3 6
      install/deb/apache2/unassigned.conf
  3. 0 16
      install/hst-install-debian.sh
  4. 0 16
      install/hst-install-ubuntu.sh

+ 10 - 2
bin/v-add-sys-ip

@@ -130,13 +130,21 @@ if [ ! -z "$WEB_SYSTEM" ]; then
             echo "NameVirtualHost $ip:$WEB_PORT" >  $web_conf
         fi
         echo "Listen $ip:$WEB_PORT" >> $web_conf
+        cat $HESTIA/install/deb/apache2/unassigned.conf >> $web_conf
+        sed -i 's/directIP/'$ip'/g' $web_conf
+        sed -i 's/directPORT/'$WEB_PORT'/g' $web_conf
+
+    elif [ "$WEB_SYSTEM" = 'nginx' ]; then
+        cp -f $HESTIA/install/deb/nginx/unassigned.inc $web_conf
+        sed -i 's/directIP/'$ip'/g' $web_conf
     fi
 
     if [ "$WEB_SSL" = 'mod_ssl' ]; then
         if [ -z "$(/usr/sbin/apachectl -v | grep Apache/2.4)" ]; then
-            echo "NameVirtualHost $ip:$WEB_SSL_PORT" >> $web_conf
+            sed -i "1s/^/NameVirtualHost $ip:$WEB_SSL_PORT\n/" $web_conf
         fi
-        echo "Listen $ip:$WEB_SSL_PORT" >> $web_conf
+        sed -i "1s/^/Listen $ip:$WEB_SSL_PORT\n/" $web_conf
+        sed -i 's/directSSLPORT/'$WEB_SSL_PORT'/g' $web_conf
     fi
 fi
 

+ 3 - 6
install/deb/apache2/unassigned.conf

@@ -1,16 +1,13 @@
-Listen directIP:8080
-Listen directIP:8443
-
-<VirtualHost directIP:80>
+<VirtualHost directIP:directPORT>
   
     DocumentRoot /var/www/html/
     Alias /error/ /var/www/document_errors/
 
 </VirtualHost>
 
-<VirtualHost directIP:443>
+<VirtualHost directIP:directSSLPORT>
   
     DocumentRoot /var/www/html/
     Alias /error/ /var/www/document_errors/
 
-</VirtualHost>
+</VirtualHost>

+ 0 - 16
install/hst-install-debian.sh

@@ -1662,22 +1662,6 @@ 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

+ 0 - 16
install/hst-install-ubuntu.sh

@@ -1589,22 +1589,6 @@ 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