Try to support bunkerweb

This commit is contained in:
Alexey Berezhok
2026-04-11 00:41:04 +03:00
parent d76624ff43
commit 4cb55905cc
164 changed files with 356 additions and 258 deletions

View File

@@ -79,9 +79,9 @@ EOF
chown root:$user $fastcgi
chmod 640 $fastcgi
str="fastcgi_cache_path /var/cache/nginx/micro/$domain levels=1:2"
str="fastcgi_cache_path /usr/local/hestia/nginx-system/var/cache/nginx/micro/$domain levels=1:2"
str="$str keys_zone=$domain:10m max_size=512m inactive=30m use_temp_path=off;"
conf='/etc/nginx/conf.d/fastcgi_cache_pool.conf'
conf='/usr/local/hestia/nginx-system/etc/nginx/conf.d/fastcgi_cache_pool.conf'
if [ -f "$conf" ]; then
if [ -z "$(grep "=${domain}:" $conf)" ]; then
echo "$str" >> $conf
@@ -90,7 +90,7 @@ else
echo "$str" >> $conf
fi
mkdir -p /var/cache/nginx/micro/$domain
mkdir -p /usr/local/hestia/nginx-system/var/cache/nginx/micro/$domain
#----------------------------------------------------------#
# Hestia #

View File

@@ -68,13 +68,13 @@ if [ "$type" = "pma" ] || [ "$type" = "PMA" ] || [ "$type" = "phpmyadmin" ]; the
$BIN/v-restart-service httpd
fi
if [ -e "/etc/nginx/conf.d/phpmyadmin.inc" ]; then
rm -f /etc/nginx/conf.d/phpmyadmin.inc
cp -f $HESTIA_INSTALL_DIR/nginx/phpmyadmin.inc /etc/nginx/conf.d/phpmyadmin.inc
sed -i "s|%pma_alias%|$alias|g" /etc/nginx/conf.d/phpmyadmin.inc
if [ -e "/usr/local/hestia/nginx-system/etc/nginx/conf.d/phpmyadmin.inc" ]; then
rm -f /usr/local/hestia/nginx-system/etc/nginx/conf.d/phpmyadmin.inc
cp -f $HESTIA_INSTALL_DIR/nginx/phpmyadmin.inc /usr/local/hestia/nginx-system/etc/nginx/conf.d/phpmyadmin.inc
sed -i "s|%pma_alias%|$alias|g" /usr/local/hestia/nginx-system/etc/nginx/conf.d/phpmyadmin.inc
# Restart services
$BIN/v-restart-service nginx
$BIN/v-restart-service nginx-system
fi
fi
@@ -105,13 +105,13 @@ if [ "$type" = "pga" ] || [ "$type" = "PGA" ] || [ "$type" = "phppgadmin" ]; the
$BIN/v-restart-service httpd
fi
if [ -e "/etc/nginx/conf.d/phppgadmin.inc" ]; then
rm -f /etc/nginx/conf.d/phppgadmin.inc
cp -f $HESTIA_INSTALL_DIR/nginx/phppgadmin.inc /etc/nginx/conf.d/phppgadmin.inc
sed -i "s|%pga_alias%|$alias|g" /etc/nginx/conf.d/phppgadmin.inc
if [ -e "/usr/local/hestia/nginx-system/etc/nginx/conf.d/phppgadmin.inc" ]; then
rm -f /usr/local/hestia/nginx-system/etc/nginx/conf.d/phppgadmin.inc
cp -f $HESTIA_INSTALL_DIR/nginx/phppgadmin.inc /usr/local/hestia/nginx-system/etc/nginx/conf.d/phppgadmin.inc
sed -i "s|%pga_alias%|$alias|g" /usr/local/hestia/nginx-system/etc/nginx/conf.d/phppgadmin.inc
# Restart services
$BIN/v-restart-service nginx
$BIN/v-restart-service nginx-system
fi
fi

View File

@@ -65,18 +65,18 @@ fi
# Defining dst config path
case $service in
nginx) dst='/etc/nginx/nginx.conf' ;;
nginx) dst='/usr/local/hestia/nginx-system/etc/nginx/nginx.conf' ;;
httpd) dst='/etc/httpd/conf/httpd.conf' ;;
apache2) dst='/etc/apache2/apache2.conf' ;;
exim) dst='/etc/exim/exim.conf' ;;
exim4) dst='/etc/exim4/exim4.conf.template' ;;
vsftpd) dst=$(find /etc/vsftpd* -name 'vsftpd.conf') ;;
proftpd) dst=$(find /etc/proftpd* -name 'proftpd.conf') ;;
php)
php)
if [ "$LOCAL_PHP" == "yes" ]; then
dst=$(find /opt/brepo/php${php_v} -name php.ini)
dst=$(find /opt/brepo/php${php_v} -name php.ini)
else
dst=$(find /etc/opt/remi/php${php_v} -name php.ini)
dst=$(find /etc/opt/remi/php${php_v} -name php.ini)
fi
;;
mysql) dst=$(find /etc/my* -name my.cnf) ;;

View File

@@ -31,7 +31,7 @@ SERVICE_NAME="$1"
case "$SERVICE_NAME" in
nginx )
/usr/sbin/nginx -t >> "$DEBUG_LOG_FILE" 2>&1
/usr/local/hestia/nginx-system/sbin/nginx -t >> "$DEBUG_LOG_FILE" 2>&1
V_RESULT=$?
exit $V_RESULT
;;
@@ -47,5 +47,3 @@ esac
# Something like error, we shouldn't be here
exit 1

View File

@@ -49,7 +49,7 @@ if [ -f "$HOMEDIR/$user/conf/web/$domain/$WEB_SYSTEM.fastcgi_cache.conf" ]; then
rm -rf $HOMEDIR/$user/conf/web/$domain/$WEB_SYSTEM.fastcgi_cache.conf
fi
conf='/etc/nginx/conf.d/fastcgi_cache_pool.conf'
conf='/usr/local/hestia/nginx-system/etc/nginx/conf.d/fastcgi_cache_pool.conf'
if [ -f "$conf" ]; then
sed -i "/ keys_zone=$domain/d" $conf
if [ ! -s "$conf" ]; then
@@ -58,7 +58,7 @@ if [ -f "$conf" ]; then
fi
# Delete FastCGI cache folder
if [ -d "/var/cache/nginx/micro/$domain" ]; then
if [ -d "/usr/local/hestia/nginx-system/var/cache/nginx/micro/$domain" ]; then
rm -rf /var/cache/nginx/micro/$domain
fi

View File

@@ -65,7 +65,7 @@ csv_list() {
#----------------------------------------------------------#
# Defining config path
config_path='/etc/nginx/nginx.conf'
config_path='/usr/local/hestia/nginx-system/etc/nginx/nginx.conf'
# Defining keys
keys="worker_processes |worker_connections |send_timeout"

View File

@@ -48,13 +48,13 @@ conf=$(grep "DOMAIN='$domain'" "$USER_DATA/web.conf")
parse_object_kv_list "$conf"
# Purge nginx FastCGI cache
if [ -d "/var/cache/nginx/micro/$domain" ]; then
rm -rf /var/cache/nginx/micro/$domain/*
if [ -d "/usr/local/hestia/nginx-system/var/cache/nginx/micro/$domain" ]; then
rm -rf /usr/local/hestia/nginx-system/var/cache/nginx/micro/$domain/*
fi
# Purge nginx proxy cache
if [ -d "/var/cache/nginx/$domain" ]; then
rm -rf /var/cache/nginx/$domain/*
if [ -d "/usr/local/hestia/nginx-system/var/cache/nginx/$domain" ]; then
rm -rf /usr/local/hestia/nginx-system/var/cache/nginx/$domain/*
fi
#----------------------------------------------------------#

View File

@@ -25,10 +25,14 @@ send_email_report() {
email=$(echo "$email" | cut -f 2 -d "'")
tmpfile=$(mktemp)
subj="$(hostname): $PROXY_SYSTEM restart failed"
nginx -t >> $tmpfile 2>&1
/usr/local/hestia/nginx-system/sbin/nginx -t >> $tmpfile 2>&1
if [ "$1" == "DO_RESTART" ]; then
service "$PROXY_SYSTEM" restart >> $tmpfile 2>&1
if [ "$PROXY_SYSTEM" = "nginx" ]; then
service nginx-system restart >> $tmpfile 2>&1
else
service "$PROXY_SYSTEM" restart >> $tmpfile 2>&1
fi
fi
cat "$tmpfile" | $SENDMAIL -s "$subj" "$email"
if [ "$DEBUG_MODE" = "true" ]; then

View File

@@ -73,7 +73,7 @@ for service in $service_list; do
$BIN/v-stop-firewall
$BIN/v-update-firewall
elif [ "$restart" = "ssl" ] && [ "$service" = "nginx" ]; then
service $service upgrade >> $log 2>&1
service nginx-system upgrade >> $log 2>&1
elif [ -z "$restart" -o "$restart" = "no" ] && [ \
"$service" = "nginx" -o \
"$service" = "httpd" -o \
@@ -86,10 +86,19 @@ for service in $service_list; do
"$service" = "proftpd" -o \
"$service" = "ssh" -o \
"$service" = "fail2ban" ]; then
systemctl reload-or-restart "$service" >> $log 2>&1
if [ "$service" = "nginx" ]; then
systemctl reload-or-restart nginx-system >> $log 2>&1
else
systemctl reload-or-restart "$service" >> $log 2>&1
fi
else
systemctl reset-failed "$service" >> $log 2>&1
systemctl restart "$service" >> $log 2>&1
if [ "$service" = "nginx" ]; then
systemctl reset-failed nginx-system >> $log 2>&1
systemctl restart nginx-system >> $log 2>&1
else
systemctl reset-failed "$service" >> $log 2>&1
systemctl restart "$service" >> $log 2>&1
fi
fi
# Check the result of the service restart and report whether it failed.

View File

@@ -86,7 +86,11 @@ if [ -n "$old_ip" ]; then
# Updating PROXY
if [ -n "$PROXY_SYSTEM" ]; then
cd /etc/$PROXY_SYSTEM/$pconfd
if [ "$PROXY_SYSTEM" = "nginx" ]; then
cd /usr/local/hestia/nginx-system/etc/nginx/$pconfd
else
cd /etc/$PROXY_SYSTEM/$pconfd
fi
if [ -e "$old_ip.conf" ]; then
mv $old_ip.conf $new_ip.conf
sed -i "s/$old_ip/$new_ip/g" $new_ip.conf
@@ -95,7 +99,11 @@ if [ -n "$old_ip" ]; then
# Updating WEB
if [ -n "$WEB_SYSTEM" ]; then
cd /etc/$WEB_SYSTEM/$confd
if [ "$WEB_SYSTEM" = "nginx" ]; then
cd /usr/local/hestia/nginx-system/etc/nginx/$confd
else
cd /etc/$WEB_SYSTEM/$confd
fi
if [ -e "$old_ip.conf" ]; then
mv $old_ip.conf $new_ip.conf
@@ -161,8 +169,8 @@ for ip in $ips; do
prefixlen="$(ip -d -j addr show | jq --arg IP "$ip" -r '.[].addr_info[] | if .local == $IP then .prefixlen else empty end')"
netmask="$(convert_cidr "$prefixlen")"
$BIN/v-add-sys-ip "$ip" "$netmask" "$interface"
elif [ -e "/etc/nginx/conf.d/$ip.conf" ]; then
process_http2_directive "/etc/nginx/conf.d/$ip.conf"
elif [ -e "/usr/local/hestia/nginx-system/etc/nginx/conf.d/$ip.conf" ]; then
process_http2_directive "/usr/local/hestia/nginx-system/etc/nginx/conf.d/$ip.conf"
fi
done