Skip to content

Commit d7cc126

Browse files
author
Kristan Kenney
authored
Merge pull request hestiacp#314 from Lupul/Bugfix-0514-installer
Fix: Configure unassigned web page after adding IP address to Hestia Fix: memory stats on v-list-sys-services Fix: Move webserver config for unassigned domains to v-add-sys-ip from upgrade script Fix: Upgrade script will create webserver configs for unassigned domains …
2 parents 19580da + 65ccd99 commit d7cc126

File tree

6 files changed

+68
-66
lines changed

6 files changed

+68
-66
lines changed

bin/v-add-sys-ip

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,21 @@ if [ ! -z "$WEB_SYSTEM" ]; then
130130
echo "NameVirtualHost $ip:$WEB_PORT" > $web_conf
131131
fi
132132
echo "Listen $ip:$WEB_PORT" >> $web_conf
133+
cat $HESTIA/install/deb/apache2/unassigned.conf >> $web_conf
134+
sed -i 's/directIP/'$ip'/g' $web_conf
135+
sed -i 's/directPORT/'$WEB_PORT'/g' $web_conf
136+
137+
elif [ "$WEB_SYSTEM" = 'nginx' ]; then
138+
cp -f $HESTIA/install/deb/nginx/unassigned.inc $web_conf
139+
sed -i 's/directIP/'$ip'/g' $web_conf
133140
fi
134141

135142
if [ "$WEB_SSL" = 'mod_ssl' ]; then
136143
if [ -z "$(/usr/sbin/apachectl -v | grep Apache/2.4)" ]; then
137-
echo "NameVirtualHost $ip:$WEB_SSL_PORT" >> $web_conf
144+
sed -i "1s/^/NameVirtualHost $ip:$WEB_SSL_PORT\n/" $web_conf
138145
fi
139-
echo "Listen $ip:$WEB_SSL_PORT" >> $web_conf
146+
sed -i "1s/^/Listen $ip:$WEB_SSL_PORT\n/" $web_conf
147+
sed -i 's/directSSLPORT/'$WEB_SSL_PORT'/g' $web_conf
140148
fi
141149
fi
142150

bin/v-list-sys-services

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ get_srv_state() {
7878
srv=$1
7979
name=${2-$1}
8080
state='running'
81+
mem=0
82+
cpu=0
83+
rtime="0"
8184

8285
# Searching related pids
8386
if [ -z $3 ]; then
@@ -92,6 +95,7 @@ get_srv_state() {
9295
# Checking pid
9396
if [ ! -z "$pids" ]; then
9497
pid=$(echo "$pids" |cut -f 1 -d '|')
98+
pids=${pids%|}
9599
pids=$(egrep "$pids" $tmp_file)
96100

97101
# Calculating CPU usage
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
Listen directIP:8080
2-
Listen directIP:8443
3-
4-
<VirtualHost directIP:80>
1+
<VirtualHost directIP:directPORT>
52

63
DocumentRoot /var/www/html/
74
Alias /error/ /var/www/document_errors/
85

96
</VirtualHost>
107

11-
<VirtualHost directIP:443>
8+
<VirtualHost directIP:directSSLPORT>
129

1310
DocumentRoot /var/www/html/
1411
Alias /error/ /var/www/document_errors/
1512

16-
</VirtualHost>
13+
</VirtualHost>

install/hst-install-debian.sh

Lines changed: 6 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"
@@ -1803,11 +1787,13 @@ cat $tmpfile
18031787
rm -f $tmpfile
18041788

18051789
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
1790+
if [ "$interactive" = 'yes' ]; then
1791+
echo -n " Do you want to logout now? [Y/N] "
1792+
read resetshell
18081793

1809-
if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
1810-
logout
1794+
if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
1795+
logout
1796+
fi
18111797
fi
18121798

18131799
# EOF

install/hst-install-ubuntu.sh

Lines changed: 6 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"
@@ -1710,11 +1694,13 @@ cat $tmpfile
17101694
rm -f $tmpfile
17111695

17121696
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
1697+
if [ "$interactive" = 'yes' ]; then
1698+
echo -n " Do you want to logout now? [Y/N] "
1699+
read resetshell
17151700

1716-
if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
1717-
logout
1701+
if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
1702+
logout
1703+
fi
17181704
fi
17191705

17201706
# EOF

install/upgrade/0.10.0-190430.sh

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -175,24 +175,45 @@ if [ -d "/etc/roundcube" ]; then
175175
fi
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
198219
php_versions=$(ls /etc/php/*/fpm -d 2>/dev/null |wc -l)

0 commit comments

Comments
 (0)