Added fixes for rpm based system usage

This commit is contained in:
Alexey Berezhok
2024-04-14 22:48:16 +03:00
parent 68a01be7c3
commit 8bcf0d1d01
46 changed files with 351 additions and 118 deletions

View File

@@ -750,7 +750,7 @@ cp -r /etc/nginx/* $hst_backups/nginx > /dev/null 2>&1
# Backup Apache configuration
systemctl stop httpd > /dev/null 2>&1
cp -r /etc/httpd/* $hst_backups/httpd > /dev/null 2>&1
rm -f /etc/httpd/conf.d/* > /dev/null 2>&1
rm -f /etc/httpd/conf.h.d/* > /dev/null 2>&1
# Backup PHP-FPM configuration
systemctl stop php*-fpm > /dev/null 2>&1
@@ -1309,12 +1309,12 @@ check_result $? "nginx start failed"
if [ "$apache" = 'yes' ]; then
echo "[ * ] Configuring Apache Web Server..."
mkdir -p /etc/httpd/conf.d
mkdir -p /etc/httpd/conf.d/domains
mkdir -p /etc/httpd/conf.h.d
mkdir -p /etc/httpd/conf.h.d/domains
# Copy configuration files
cp -f $HESTIA_INSTALL_DIR/httpd/httpd.conf /etc/httpd/conf/
cp -f $HESTIA_INSTALL_DIR/httpd/status.conf /etc/httpd/conf.d/hestia-status.conf
cp -f $HESTIA_INSTALL_DIR/httpd/status.conf /etc/httpd/conf.h.d/hestia-status.conf
cp -f $HESTIA_INSTALL_DIR/logrotate/httpd /etc/logrotate.d/
# Enable needed modules
@@ -1334,7 +1334,7 @@ if [ "$apache" = 'yes' ]; then
# Disable prefork and php, enable event
sed 's/LoadModule mpm_prefork_module/#LoadModule mpm_prefork_module/' -i /etc/httpd/conf.modules.d/00-mpm.conf
sed 's/#LoadModule mpm_event_module/LoadModule mpm_event_module/' -i /etc/httpd/conf.modules.d/00-mpm.conf
cp -f $HESTIA_INSTALL_DIR/httpd/hestia-event.conf /etc/httpd/conf.d/
cp -f $HESTIA_INSTALL_DIR/httpd/hestia-event.conf /etc/httpd/conf.h.d/
fi
if [ ! -d /etc/httpd/sites-available ]; then
@@ -1517,7 +1517,7 @@ if [ "$mysql" = 'yes' ] || [ "$mysql8" = 'yes' ]; then
# Configuring Apache2 for PHPMYADMIN
if [ "$apache" = 'yes' ]; then
touch /etc/httpd/conf.d/phpmyadmin.inc
touch /etc/httpd/conf.h.d/phpmyadmin.inc
fi
# Overwrite old files
@@ -1580,7 +1580,7 @@ if [ "$postgresql" = 'yes' ]; then
ln -s /etc/phppgadmin/config.inc.php /usr/share/phppgadmin/conf/
# Configuring phpPgAdmin
if [ "$apache" = 'yes' ]; then
cp -f $HESTIA_INSTALL_DIR/pga/phppgadmin.conf /etc/httpd/conf.d/phppgadmin.inc
cp -f $HESTIA_INSTALL_DIR/pga/phppgadmin.conf /etc/httpd/conf.h.d/phppgadmin.inc
fi
cp -f $HESTIA_INSTALL_DIR/pga/config.inc.php /etc/phppgadmin/

View File

@@ -434,7 +434,7 @@ fi
# Validate whether installation script matches release version before continuing with install
if [ -z "$withdebs" ] || [ ! -d "$withdebs" ]; then
release_branch_ver=$(curl -s https://raw.githubusercontent.com/hestiacp/hestiacp/release/src/deb/hestia/control | grep "Version:" | awk '{print $2}')
release_branch_ver=$(curl -s https://dev.putey.net/bayrepo/hestiacp/raw/branch/master/src/deb/hestia/control | grep "Version:" | awk '{print $2}')
if [ "$HESTIA_INSTALL_VER" != "$release_branch_ver" ]; then
echo
echo -e "\e[91mInstallation aborted\e[0m"
@@ -442,7 +442,7 @@ if [ -z "$withdebs" ] || [ ! -d "$withdebs" ]; then
echo -e "\e[33mERROR: Install script version does not match package version!\e[0m"
echo -e "\e[33mPlease download the installer from the release branch in order to continue:\e[0m"
echo ""
echo -e "\e[33mhttps://raw.githubusercontent.com/hestiacp/hestiacp/release/install/hst-install.sh\e[0m"
echo -e "\e[33mhttps://dev.putey.net/bayrepo/hestiacp/raw/branch/master/install/hst-install.sh\e[0m"
echo ""
echo -e "\e[33mTo test pre-release versions, build the .deb packages and re-run the installer:\e[0m"
echo -e " \e[33m./hst_autocompile.sh \e[1m--hestia branchname no\e[21m\e[0m"

View File

@@ -55,4 +55,4 @@ EnableSendfile on
LogFormat "%a %l %u %t \"%r\" %>s %b" common
</IfModule>
IncludeOptional conf.d/*.conf
IncludeOptional conf.h.d/*.conf

View File

@@ -67,9 +67,9 @@ LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
LogFormat "%b" bytes
Include conf.d/*.conf
IncludeOptional conf.d/domains/webmail.*.conf
IncludeOptional conf.d/domains/*.conf
Include conf.h.d/*.conf
IncludeOptional conf.h.d/domains/webmail.*.conf
IncludeOptional conf.h.d/domains/*.conf
ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html

View File

@@ -45,5 +45,5 @@
</IfModule>
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.ssl.conf_*
IncludeOptional /etc/httpd/conf.d/*.inc
IncludeOptional /etc/httpd/conf.h.d/*.inc
</VirtualHost>

View File

@@ -42,5 +42,5 @@
</IfModule>
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.conf_*
IncludeOptional /etc/httpd/conf.d/*.inc
IncludeOptional /etc/httpd/conf.h.d/*.inc
</VirtualHost>

View File

@@ -51,5 +51,5 @@
</IfModule>
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.ssl.conf_*
IncludeOptional /etc/httpd/conf.d/*.inc*
IncludeOptional /etc/httpd/conf.h.d/*.inc*
</VirtualHost>

View File

@@ -48,5 +48,5 @@
</IfModule>
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.conf_*
IncludeOptional /etc/httpd/conf.d/*.inc
IncludeOptional /etc/httpd/conf.h.d/*.inc
</VirtualHost>

View File

@@ -37,5 +37,5 @@
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.ssl.conf_*
IncludeOptional /etc/httpd/conf.d/*.inc
IncludeOptional /etc/httpd/conf.h.d/*.inc
</VirtualHost>

View File

@@ -34,5 +34,5 @@
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.conf_*
IncludeOptional /etc/httpd/conf.d/*.inc
IncludeOptional /etc/httpd/conf.h.d/*.inc
</VirtualHost>

View File

@@ -40,5 +40,5 @@
%ssl_ca_str%SSLCertificateChainFile %ssl_ca%
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.ssl.conf_*
IncludeOptional /etc/httpd/conf.d/*.inc
IncludeOptional /etc/httpd/conf.h.d/*.inc
</VirtualHost>

View File

@@ -36,5 +36,5 @@
AllowOverride All
</Directory>
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.conf_*
IncludeOptional /etc/httpd/conf.d/*.inc
IncludeOptional /etc/httpd/conf.h.d/*.inc
</VirtualHost>

View File

@@ -41,5 +41,5 @@
%ssl_ca_str%SSLCertificateChainFile %ssl_ca%
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.ssl.conf_*
IncludeOptional /etc/httpd/conf.d/*.inc
IncludeOptional /etc/httpd/conf.h.d/*.inc
</VirtualHost>

View File

@@ -36,5 +36,5 @@
AllowOverride All
</Directory>
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.conf_*
IncludeOptional /etc/httpd/conf.d/*.inc
IncludeOptional /etc/httpd/conf.h.d/*.inc
</VirtualHost>

View File

@@ -37,5 +37,5 @@
%ssl_ca_str%SSLCertificateChainFile %ssl_ca%
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.ssl.conf_*
IncludeOptional /etc/httpd/conf.d/*.inc
IncludeOptional /etc/httpd/conf.h.d/*.inc
</VirtualHost>

View File

@@ -34,5 +34,5 @@
</Directory>
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.conf_*
IncludeOptional /etc/httpd/conf.d/*.inc
IncludeOptional /etc/httpd/conf.h.d/*.inc
</VirtualHost>

View File

@@ -65,6 +65,12 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
fi
if [ "$WEB_SYSTEM" == "httpd" ]; then
cp -f $HESTIA_INSTALL_DIR/pma/apache.conf /etc/phpmyadmin/
rm /etc/httpd/conf.h.d/phpmyadmin.conf
ln -s /etc/phpmyadmin/apache.conf /etc/httpd/conf.h.d/phpmyadmin.conf
fi
PASS=$(generate_password)
echo "[ * ] Installing phpMyAdmin version v$pma_v..."

View File

@@ -52,6 +52,10 @@ if [ -f "/etc/apache2/conf.d/hestia.conf" ]; then
echo "[ * ] Removing old Apache configuration file from previous version of Hestia Control Panel..."
rm -f /etc/apache2/conf.d/hestia.conf
fi
if [ -f "/etc/httpd/conf.h.d/hestia.conf" ]; then
echo "[ * ] Removing old Apache configuration file from previous version of Hestia Control Panel..."
rm -f /etc/httpd/conf.h.d/hestia.conf
fi
if [ -f "/etc/nginx/conf.d/hestia.conf" ]; then
echo "[ * ] Removing old NGINX configuration file from previous version of Hestia Control Panel..."
rm -f /etc/nginx/conf.d/hestia.conf

View File

@@ -6,6 +6,17 @@
####### Place additional commands below. #######
#######################################################################################
if [ "$WEB_SYSTEM" = "httpd" ]; then
confd="conf.h.d"
else
confd="conf.d"
fi
if [ "$PROXY_SYSTEM" = "httpd" ]; then
pconfd="conf.h.d"
else
pconfd="conf.d"
fi
# Add webmail alias variable to system configuration if non-existent
if [ -z "$WEBMAIL_ALIAS" ]; then
echo "[ * ] Updating webmail alias configuration..."
@@ -119,7 +130,7 @@ done
# Add unassigned hosts configuration to Nginx and Apache
for ipaddr in $($BIN/v-list-sys-ips plain | cut -f1); do
web_conf="/etc/$WEB_SYSTEM/conf.d/$ipaddr.conf"
web_conf="/etc/$WEB_SYSTEM/$confd/$ipaddr.conf"
rm -f $web_conf
if [ "$WEB_SYSTEM" = "apache2" ]; then
@@ -151,7 +162,7 @@ for ipaddr in $($BIN/v-list-sys-ips plain | cut -f1); do
| sed -e "s/%ip%/$ipaddr/g" \
-e "s/%web_port%/$WEB_PORT/g" \
-e "s/%proxy_port%/$PROXY_PORT/g" \
> /etc/$PROXY_SYSTEM/conf.d/$ipaddr.conf
> /etc/$PROXY_SYSTEM/$pconfd/$ipaddr.conf
fi
done

View File

@@ -197,13 +197,25 @@ chown root:root /var/log/$WEB_SYSTEM/domains/$WEBMAIL_ALIAS* > /dev/null 2>&1
if [ "$IMAP_SYSTEM" = "dovecot" ]; then
echo "[ * ] Enabling IMAP quota information reporting..."
if [ -e /etc/dovecot/conf.d/20-pop3.conf ]; then
cp -f $HESTIA/install/deb/dovecot/conf.d/20-pop3.conf /etc/dovecot/conf.d/20-pop3.conf
if [ -e /etc/redhat-release ]; then
cp -f $HESTIA/install/rpm/dovecot/conf.d/20-pop3.conf /etc/dovecot/conf.d/20-pop3.conf
else
cp -f $HESTIA/install/deb/dovecot/conf.d/20-pop3.conf /etc/dovecot/conf.d/20-pop3.conf
fi
fi
if [ -e /etc/dovecot/conf.d/20-imap.conf ]; then
cp -f $HESTIA/install/deb/dovecot/conf.d/20-imap.conf /etc/dovecot/conf.d/20-imap.conf
if [ -e /etc/redhat-release ]; then
cp -f $HESTIA/install/rpm/dovecot/conf.d/20-imap.conf /etc/dovecot/conf.d/20-imap.conf
else
cp -f $HESTIA/install/deb/dovecot/conf.d/20-imap.conf /etc/dovecot/conf.d/20-imap.conf
fi
fi
if [ -e /etc/dovecot/conf.d/90-quota.conf ]; then
cp -f $HESTIA/install/deb/dovecot/conf.d/90-quota.conf /etc/dovecot/conf.d/90-quota.conf
if [ -e /etc/redhat-release ]; then
cp -f $HESTIA/install/deb/dovecot/conf.d/90-quota.conf /etc/dovecot/conf.d/90-quota.conf
else
cp -f $HESTIA/install/deb/dovecot/conf.d/90-quota.conf /etc/dovecot/conf.d/90-quota.conf
fi
fi
fi
@@ -222,3 +234,6 @@ fi
if [ -e /etc/apache2/conf.d/roundcube.conf ]; then
rm -f /etc/apache2/conf.d/roundcube.conf
fi
if [ -e /etc/httpd/conf.h.d/roundcube.conf ]; then
rm -f /etc/httpd/conf.h.d/roundcube.conf
fi

View File

@@ -26,6 +26,10 @@ if [ -n "$DB_PMA_ALIAS" ]; then
rm /etc/apache2/conf.d/phpmyadmin.conf
touch /etc/apache2/conf.d/phpmyadmin.inc
fi
if [ -e "/etc/httpd/conf.h.d/phpmyadmin.conf" ]; then
rm /etc/httpd/conf.h.d/phpmyadmin.conf
touch /etc/httpd/conf.h.d/phpmyadmin.inc
fi
$HESTIA/bin/v-change-sys-db-alias 'pma' "$DB_PMA_ALIAS"
fi
@@ -34,6 +38,10 @@ if [ -n "$DB_PGA_ALIAS" ]; then
rm /etc/apache2/conf.d/phppgadmin.conf
touch /etc/apache2/conf.d/phppgadmin.inc
fi
if [ -e "/etc/httpd/conf.h.d/phppgadmin.conf" ]; then
rm /etc/httpd/conf.h.d/phppgadmin.conf
touch /etc/httpd/conf.h.d/phppgadmin.inc
fi
$HESTIA/bin/v-change-sys-db-alias 'pga' "$DB_PGA_ALIAS"
fi

View File

@@ -44,3 +44,10 @@ if [ "$WEB_SYSTEM" = "apache2" ]; then
sed -i "s/IncludeOptional conf.d\/domains\/\*.conf/IncludeOptional conf.d\/domains\/$WEBMAIL_ALIAS.*.conf\nIncludeOptional conf.d\/domains\/\*.conf/g" /etc/apache2/apache2.conf
fi
fi
if [ "$WEB_SYSTEM" = "httpd" ]; then
if ! (grep -q "$WEBMAIL_ALIAS.*.conf" /etc/httpd/conf/httpd.conf); then
echo "[ * ] Update /etc/httpd/conf/httpd.conf..."
sed -i "s/IncludeOptional conf.d\/domains\/\*.conf/IncludeOptional conf.d\/domains\/$WEBMAIL_ALIAS.*.conf\nIncludeOptional conf.d\/domains\/\*.conf/g" /etc/httpd/conf/httpd.conf
fi
fi