@@ -175,24 +175,45 @@ if [ -d "/etc/roundcube" ]; then
175175fi
176176
177177# Add unassigned hosts configuration to Nginx and Apache
178- if [ " $WEB_SYSTEM " = " apache2" ]; then
179- echo " (*) Adding unassigned hosts configuration to Apache..."
180- for ip in /usr/local/hestia/data/ips/* ; do
181- ipaddr=${ip##*/ }
182- rm -f /etc/apache2/conf.d/$ip .conf
183- cp -f $HESTIA /install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ipaddr .conf
184- sed -i ' s/directIP/' $ipaddr ' /g' /etc/apache2/conf.d/$ipaddr .conf
185- done
186- fi
187- if [ " $PROXY_SYSTEM " = " nginx" ]; then
188- echo " (*) Adding unassigned hosts configuration to Nginx..."
189- for ip in /usr/local/hestia/data/ips/* ; do
190- ipaddr=${ip##*/ }
191- rm -f /etc/nginx/conf.d/$ip .conf
192- cp -f $HESTIA /install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ipaddr .conf
193- sed -i ' s/directIP/' $ipaddr ' /g' /etc/nginx/conf.d/$ipaddr .conf
194- done
195- fi
178+ for ipaddr in $( ls /usr/local/hestia/data/ips/ 2> /dev/null) ; do
179+
180+ web_conf=" /etc/$WEB_SYSTEM /conf.d/$ipaddr .conf"
181+ rm -f $web_conf
182+
183+ if [ " $WEB_SYSTEM " = " apache2" ]; then
184+ echo " (*) Adding unassigned hosts configuration to Apache..."
185+ if [ -z " $( /usr/sbin/apachectl -v | grep Apache/2.4) " ]; then
186+ echo " NameVirtualHost $ipaddr :$WEB_PORT " > $web_conf
187+ fi
188+ echo " Listen $ipaddr :$WEB_PORT " >> $web_conf
189+ cat $HESTIA /install/deb/apache2/unassigned.conf >> $web_conf
190+ sed -i ' s/directIP/' $ipaddr ' /g' $web_conf
191+ sed -i ' s/directPORT/' $WEB_PORT ' /g' $web_conf
192+
193+ if [ " $WEB_SSL " = ' mod_ssl' ]; then
194+ if [ -z " $( /usr/sbin/apachectl -v | grep Apache/2.4) " ]; then
195+ sed -i " 1s/^/NameVirtualHost $ipaddr :$WEB_SSL_PORT \n/" $web_conf
196+ fi
197+ sed -i " 1s/^/Listen $ipaddr :$WEB_SSL_PORT \n/" $web_conf
198+ sed -i ' s/directSSLPORT/' $WEB_SSL_PORT ' /g' $web_conf
199+ fi
200+
201+ elif [ " $WEB_SYSTEM " = " nginx" ]; then
202+ cp -f $HESTIA /install/deb/nginx/unassigned.inc $web_conf
203+ sed -i ' s/directIP/' $ipaddr ' /g' $web_conf
204+ fi
205+
206+ if [ " $PROXY_SYSTEM " = " nginx" ]; then
207+ echo " (*) Adding unassigned hosts configuration to Nginx..."
208+ cat $WEBTPL /$PROXY_SYSTEM /proxy_ip.tpl | \
209+ sed -e " s/%ip%/$ipaddr /g" \
210+ -e " s/%web_port%/$WEB_PORT /g" \
211+ -e " s/%proxy_port%/$PROXY_PORT /g" \
212+ > /etc/$PROXY_SYSTEM /conf.d/$ipaddr .conf
213+ fi
214+ done
215+
216+
196217
197218# Fix empty pool error message for MultiPHP
198219php_versions=$( ls /etc/php/* /fpm -d 2> /dev/null | wc -l)
0 commit comments