Skip to content

Commit a651238

Browse files
authored
Merge pull request hestiacp#2426 from jaapmarcus/feature/migrate-nginx-apache-nginx-fpm
Manual upgrade script from Nginx + Apache2 + PHP-FPM to Nginx + PHP_FPM
2 parents cd2268c + 1e4f471 commit a651238

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
#----------------------------------------------------------#
4+
# Variable&Function #
5+
#----------------------------------------------------------#
6+
7+
# Includes
8+
# shellcheck source=/usr/local/hestia/func/main.sh
9+
source $HESTIA/func/main.sh
10+
# shellcheck source=/usr/local/hestia/conf/hestia.conf
11+
source $HESTIA/conf/hestia.conf
12+
13+
#----------------------------------------------------------#
14+
# Verifications #
15+
#----------------------------------------------------------#
16+
17+
if [ "$WEB_BACKEND" != "php-fpm" ]; then
18+
check_result $E_NOTEXISTS "PHP-FPM is not enabled" >/dev/null
19+
exit 1;
20+
fi
21+
22+
if [ "$WEB_SYSTEM" != "apache2" ]; then
23+
check_result $E_NOTEXISTS "Apache2 is not enabled" >/dev/null
24+
exit 1;
25+
fi
26+
27+
#----------------------------------------------------------#
28+
# Action #
29+
#----------------------------------------------------------#
30+
31+
# Remove apache2 from config
32+
sed -i "/^WEB_PORT/d" $HESTIA/conf/hestia.conf
33+
sed -i "/^WEB_SSL/d" $HESTIA/conf/hestia.conf
34+
sed -i "/^WEB_SSL_PORT/d" $HESTIA/conf/hestia.conf
35+
sed -i "/^WEB_RGROUPS/d" $HESTIA/conf/hestia.conf
36+
sed -i "/^WEB_SYSTEM/d" $HESTIA/conf/hestia.conf
37+
38+
# Remove nginx (proxy) from config
39+
sed -i "/^PROXY_PORT/d" $HESTIA/conf/hestia.conf
40+
sed -i "/^PROXY_SSL_PORT/d" $HESTIA/conf/hestia.conf
41+
sed -i "/^PROXY_SYSTEM/d" $HESTIA/conf/hestia.conf
42+
43+
# Add Nginx settings to config
44+
echo "WEB_PORT='80'" >> $HESTIA/conf/hestia.conf
45+
echo "WEB_SSL='openssl'" >> $HESTIA/conf/hestia.conf
46+
echo "WEB_SSL_PORT='443'" >> $HESTIA/conf/hestia.conf
47+
echo "WEB_SYSTEM='nginx'" >> $HESTIA/conf/hestia.conf
48+
49+
# Rebuild web config
50+
51+
for user in $($HESTIA/bin/v-list-users plain | cut -f1); do
52+
echo $user
53+
for domain in $($HESTIA/bin/v-list-web-domains $user plain | cut -f1 ); do
54+
$HESTIA/bin/v-change-web-domain-tpl $user $domain 'default'
55+
$HESTIA/bin/v-rebuild-web-domain $user $domain no;
56+
done
57+
done
58+
59+
systemctl restart nginx

0 commit comments

Comments
 (0)