Skip to content

Commit f04b44a

Browse files
committed
Fix: Configure unassinged web page after adding IP addr to Hestia
1 parent 19580da commit f04b44a

File tree

2 files changed

+44
-40
lines changed

2 files changed

+44
-40
lines changed

install/hst-install-debian.sh

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,14 +1147,6 @@ if [ "$nginx" = 'yes' ]; then
11471147
check_result $? "php$fpm_v-fpm start failed"
11481148
fi
11491149

1150-
# Redirect unassigned hosts to default "Success" page
1151-
for ip in /usr/local/hestia/data/ips/*; do
1152-
ipaddr=${ip##*/}
1153-
rm -f /etc/nginx/conf.d/$ip.conf
1154-
cp -f $HESTIA/install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ipaddr.conf
1155-
sed -i 's/directIP/'$ipaddr'/g' /etc/nginx/conf.d/$ipaddr.conf
1156-
done
1157-
11581150
# Install dhparam.
11591151
cp -f $HESTIA/install/deb/ssl/dhparam.pem /etc/ssl
11601152

@@ -1209,14 +1201,6 @@ if [ "$apache" = 'yes' ]; then
12091201
fi
12101202
fi
12111203

1212-
# Add unassigned hosts configuration to apache2
1213-
for ip in /usr/local/hestia/data/ips/*; do
1214-
ipaddr=${ip##*/}
1215-
rm -f /etc/apache2/conf.d/$ip.conf
1216-
cp -f $HESTIA/install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ipaddr.conf
1217-
sed -i 's/directIP/'$ipaddr'/g' /etc/apache2/conf.d/$ipaddr.conf
1218-
done
1219-
12201204
update-rc.d apache2 defaults > /dev/null 2>&1
12211205
service apache2 start >> $LOG
12221206
check_result $? "apache2 start failed"
@@ -1678,6 +1662,22 @@ if [ ! -z "$pub_ip" ] && [ "$pub_ip" != "$ip" ]; then
16781662
ip=$pub_ip
16791663
fi
16801664

1665+
# Add unassigned hosts configuration to webserver
1666+
for ip in $(ls /usr/local/hestia/data/ips/ 2>/dev/null); do
1667+
1668+
if [ "$apache" = 'yes' ]; then
1669+
rm -f /etc/apache2/conf.d/$ip.conf
1670+
cp -f $HESTIA/install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ip.conf
1671+
sed -i 's/directIP/'$ip'/g' /etc/apache2/conf.d/$ip.conf
1672+
fi
1673+
1674+
if [ "$nginx" = 'yes' ]; then
1675+
rm -f /etc/nginx/conf.d/$ip.conf
1676+
cp -f $HESTIA/install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ip.conf
1677+
sed -i 's/directIP/'$ip'/g' /etc/nginx/conf.d/$ip.conf
1678+
fi
1679+
done
1680+
16811681
# Configuring libapache2-mod-remoteip
16821682
if [ "$apache" = 'yes' ] && [ "$nginx" = 'yes' ] ; then
16831683
cd /etc/apache2/mods-available
@@ -1803,11 +1803,13 @@ cat $tmpfile
18031803
rm -f $tmpfile
18041804

18051805
echo "(!) IMPORTANT: You must logout or restart the server before continuing."
1806-
echo -n " Do you want to logout now? [Y/N] "
1807-
read resetshell
1806+
if [ "$interactive" = 'yes' ]; then
1807+
echo -n " Do you want to logout now? [Y/N] "
1808+
read resetshell
18081809

1809-
if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
1810-
logout
1810+
if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
1811+
logout
1812+
fi
18111813
fi
18121814

18131815
# EOF

install/hst-install-ubuntu.sh

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,14 +1115,6 @@ if [ "$nginx" = 'yes' ]; then
11151115
check_result $? "php$fpm_v-fpm start failed"
11161116
fi
11171117

1118-
# Redirect unassigned hosts to default "Success" page
1119-
for ip in /usr/local/hestia/data/ips/*; do
1120-
ipaddr=${ip##*/}
1121-
rm -f /etc/nginx/conf.d/$ip.conf
1122-
cp -f $HESTIA/install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ipaddr.conf
1123-
sed -i 's/directIP/'$ipaddr'/g' /etc/nginx/conf.d/$ipaddr.conf
1124-
done
1125-
11261118
# Install dhparam.
11271119
cp -f $HESTIA/install/deb/ssl/dhparam.pem /etc/ssl
11281120

@@ -1173,14 +1165,6 @@ if [ "$apache" = 'yes' ]; then
11731165
chmod a+x $HESTIA/data/templates/web/apache2/*.sh
11741166
fi
11751167

1176-
# Add unassigned hosts configuration to apache2
1177-
for ip in /usr/local/hestia/data/ips/*; do
1178-
ipaddr=${ip##*/}
1179-
rm -f /etc/apache2/conf.d/$ip.conf
1180-
cp -f $HESTIA/install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ipaddr.conf
1181-
sed -i 's/directIP/'$ipaddr'/g' /etc/apache2/conf.d/$ipaddr.conf
1182-
done
1183-
11841168
update-rc.d apache2 defaults > /dev/null 2>&1
11851169
service apache2 start >> $LOG
11861170
check_result $? "apache2 start failed"
@@ -1605,6 +1589,22 @@ if [ ! -z "$pub_ip" ] && [ "$pub_ip" != "$ip" ]; then
16051589
ip=$pub_ip
16061590
fi
16071591

1592+
# Add unassigned hosts configuration to webserver
1593+
for ip in $(ls /usr/local/hestia/data/ips/ 2>/dev/null); do
1594+
1595+
if [ "$apache" = 'yes' ]; then
1596+
rm -f /etc/apache2/conf.d/$ip.conf
1597+
cp -f $HESTIA/install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ip.conf
1598+
sed -i 's/directIP/'$ip'/g' /etc/apache2/conf.d/$ip.conf
1599+
fi
1600+
1601+
if [ "$nginx" = 'yes' ]; then
1602+
rm -f /etc/nginx/conf.d/$ip.conf
1603+
cp -f $HESTIA/install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ip.conf
1604+
sed -i 's/directIP/'$ip'/g' /etc/nginx/conf.d/$ip.conf
1605+
fi
1606+
done
1607+
16081608
# Configuring MariaDB host
16091609
if [ "$mysql" = 'yes' ]; then
16101610
$HESTIA/bin/v-add-database-host mysql localhost root $mpass
@@ -1710,11 +1710,13 @@ cat $tmpfile
17101710
rm -f $tmpfile
17111711

17121712
echo "(!) IMPORTANT: You must logout or restart the server before continuing."
1713-
echo -n " Do you want to logout now? [Y/N] "
1714-
read resetshell
1713+
if [ "$interactive" = 'yes' ]; then
1714+
echo -n " Do you want to logout now? [Y/N] "
1715+
read resetshell
17151716

1716-
if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
1717-
logout
1717+
if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
1718+
logout
1719+
fi
17181720
fi
17191721

17201722
# EOF

0 commit comments

Comments
 (0)