Try to support bunkerweb
This commit is contained in:
@@ -51,7 +51,7 @@ php_modules_install="mysqlnd mysqli pdo_mysql pgsql pdo sqlite pdo_sqlite pdo_pg
|
||||
php_modules_disable=""
|
||||
mod_php="enable"
|
||||
|
||||
software="nginx
|
||||
software="nginx-system
|
||||
httpd.${arch} httpd-tools httpd-itk mod_fcgid mod_suphp mod_ssl
|
||||
MariaDB-client MariaDB-common MariaDB-server
|
||||
mysql.${arch} mysql-common mysql-server
|
||||
@@ -93,6 +93,7 @@ help() {
|
||||
-I, --nopublicip Use local ip [yes|no] default: yes
|
||||
-u, --uselocalphp Use PHP from local repo [yes|no] default: no
|
||||
-C, --usemirrorclamav Use mirrored clamav [yes|no] default: no
|
||||
-B, --bunkerweb Enable BunkerWeb mode [yes|no] default: no
|
||||
-s, --hostname Set hostname
|
||||
-e, --email Set admin email
|
||||
-p, --password Set admin password
|
||||
@@ -295,6 +296,7 @@ for arg; do
|
||||
--password) args="${args}-p " ;;
|
||||
--force) args="${args}-f " ;;
|
||||
--with-debs) args="${args}-D " ;;
|
||||
--bunkerweb) args="${args}-B " ;;
|
||||
--help) args="${args}-h " ;;
|
||||
--nopublicip) args="${args}-I " ;;
|
||||
--uselocalphp) args="${args}-u" ;;
|
||||
@@ -310,9 +312,10 @@ eval set -- "$args"
|
||||
use_devel=""
|
||||
|
||||
# Parsing arguments
|
||||
while getopts "u:I:a:w:v:j:k:m:M:g:d:x:z:Z:c:C:t:i:b:r:o:q:l:y:s:e:p:R:f:Dh" Option; do
|
||||
while getopts "u:I:a:w:v:j:k:m:M:g:d:x:z:Z:c:C:t:i:b:r:o:q:l:y:s:e:p:R:f:D:B:" Option; do
|
||||
case $Option in
|
||||
a) apache=$OPTARG ;; # Apache
|
||||
B) bunkerweb=$OPTARG ;; # BunkerWeb mode
|
||||
w) phpfpm=$OPTARG ;; # PHP-FPM
|
||||
o) multiphp=$OPTARG ;; # Multi-PHP
|
||||
v) vsftpd=$OPTARG ;; # Vsftpd
|
||||
@@ -377,6 +380,7 @@ set_default_value 'quota' 'no'
|
||||
set_default_value 'interactive' 'yes'
|
||||
set_default_value 'api' 'yes'
|
||||
set_default_value 'nopublicip' 'no'
|
||||
set_default_value 'bunkerweb' 'no'
|
||||
set_default_port '8083'
|
||||
set_default_lang 'en'
|
||||
set_default_value 'uselocalphp' 'no'
|
||||
@@ -829,7 +833,7 @@ mkdir nginx httpd php vsftpd proftpd bind exim dovecot clamd
|
||||
mkdir spamassassin mysql postgresql hestia
|
||||
|
||||
# Backup nginx configuration
|
||||
systemctl stop nginx > /dev/null 2>&1
|
||||
systemctl stop nginx-system > /dev/null 2>&1
|
||||
cp -r /etc/nginx/* $hst_backups/nginx > /dev/null 2>&1
|
||||
|
||||
# Backup Apache configuration
|
||||
@@ -1193,14 +1197,24 @@ if [ "$apache" = 'yes' ]; then
|
||||
write_config_value "WEB_SSL_PORT" "8443"
|
||||
write_config_value "WEB_SSL" "mod_ssl"
|
||||
write_config_value "PROXY_SYSTEM" "nginx"
|
||||
write_config_value "PROXY_PORT" "80"
|
||||
write_config_value "PROXY_SSL_PORT" "443"
|
||||
if [ "$bunkerweb" = 'yes' ]; then
|
||||
write_config_value "PROXY_PORT" "8078"
|
||||
write_config_value "PROXY_SSL_PORT" "8079"
|
||||
else
|
||||
write_config_value "PROXY_PORT" "80"
|
||||
write_config_value "PROXY_SSL_PORT" "443"
|
||||
fi
|
||||
write_config_value "STATS_SYSTEM" "awstats"
|
||||
fi
|
||||
if [ "$apache" = 'no' ]; then
|
||||
write_config_value "WEB_SYSTEM" "nginx"
|
||||
write_config_value "WEB_PORT" "80"
|
||||
write_config_value "WEB_SSL_PORT" "443"
|
||||
if [ "$bunkerweb" = 'yes' ]; then
|
||||
write_config_value "WEB_PORT" "8078"
|
||||
write_config_value "WEB_SSL_PORT" "8079"
|
||||
else
|
||||
write_config_value "WEB_PORT" "80"
|
||||
write_config_value "WEB_SSL_PORT" "443"
|
||||
fi
|
||||
write_config_value "WEB_SSL" "openssl"
|
||||
write_config_value "STATS_SYSTEM" "awstats"
|
||||
fi
|
||||
@@ -1386,17 +1400,17 @@ locale-gen "en_US.utf8" > /dev/null 2>&1
|
||||
|
||||
echo "[ * ] Configuring NGINX..."
|
||||
rm -f /etc/nginx/conf.d/*.conf
|
||||
cp -f $HESTIA_INSTALL_DIR/nginx/nginx.conf /etc/nginx/
|
||||
cp -f $HESTIA_INSTALL_DIR/nginx/status.conf /etc/nginx/conf.d/
|
||||
cp -f $HESTIA_INSTALL_DIR/nginx/0rtt-anti-replay.conf /etc/nginx/conf.d/
|
||||
cp -f $HESTIA_INSTALL_DIR/nginx/agents.conf /etc/nginx/conf.d/
|
||||
cp -f $HESTIA_INSTALL_DIR/nginx/phpmyadmin.inc /etc/nginx/conf.d/
|
||||
cp -f $HESTIA_INSTALL_DIR/nginx/phppgadmin.inc /etc/nginx/conf.d/
|
||||
cp -f $HESTIA_INSTALL_DIR/nginx/nginx.conf /usr/local/hestia/nginx-system/etc/nginx/
|
||||
cp -f $HESTIA_INSTALL_DIR/nginx/status.conf /usr/local/hestia/nginx-system/etc/nginx/conf.d/
|
||||
cp -f $HESTIA_INSTALL_DIR/nginx/0rtt-anti-replay.conf /usr/local/hestia/nginx-system/etc/nginx/conf.d/
|
||||
cp -f $HESTIA_INSTALL_DIR/nginx/agents.conf /usr/local/hestia/nginx-system/etc/nginx/conf.d/
|
||||
cp -f $HESTIA_INSTALL_DIR/nginx/phpmyadmin.inc /usr/local/hestia/nginx-system/etc/nginx/conf.d/
|
||||
cp -f $HESTIA_INSTALL_DIR/nginx/phppgadmin.inc /usr/local/hestia/nginx-system/etc/nginx/conf.d/
|
||||
cp -f $HESTIA_INSTALL_DIR/logrotate/nginx /etc/logrotate.d/
|
||||
mkdir -p /etc/nginx/conf.d/domains
|
||||
mkdir -p /etc/nginx/modules-enabled
|
||||
mkdir -p /usr/local/hestia/nginx-system/etc/nginx/conf.d/domains
|
||||
mkdir -p /usr/local/hestia/nginx-system/etc/nginx/modules-enabled
|
||||
mkdir -p /var/log/nginx/domains
|
||||
mkdir -p /etc/nginx/conf.d/main
|
||||
mkdir -p /usr/local/hestia/nginx-system/etc/nginx/conf.d/main
|
||||
|
||||
# Update dns servers in nginx.conf
|
||||
for nameserver in $(grep -is '^nameserver' /etc/resolv.conf | cut -d' ' -f2 | tr '\r\n' ' ' | xargs); do
|
||||
@@ -1409,11 +1423,11 @@ for nameserver in $(grep -is '^nameserver' /etc/resolv.conf | cut -d' ' -f2 | tr
|
||||
fi
|
||||
done
|
||||
if [ -n "$resolver" ]; then
|
||||
sed -i "s/1.1.1.1 8.8.8.8/$resolver/g" /etc/nginx/nginx.conf
|
||||
sed -i "s/1.1.1.1 8.8.8.8/$resolver/g" /usr/local/hestia/nginx-system/etc/nginx/nginx.conf
|
||||
fi
|
||||
|
||||
# https://github.com/ergin/nginx-cloudflare-real-ip/
|
||||
CLOUDFLARE_FILE_PATH='/etc/nginx/conf.d/cloudflare.inc'
|
||||
CLOUDFLARE_FILE_PATH='/usr/local/hestia/nginx-system/etc/nginx/conf.d/cloudflare.inc'
|
||||
echo "#Cloudflare" > $CLOUDFLARE_FILE_PATH
|
||||
echo "" >> $CLOUDFLARE_FILE_PATH
|
||||
|
||||
@@ -1430,7 +1444,7 @@ done
|
||||
echo "" >> $CLOUDFLARE_FILE_PATH
|
||||
echo "real_ip_header CF-Connecting-IP;" >> $CLOUDFLARE_FILE_PATH
|
||||
|
||||
systemctl enable nginx --now >> $LOG
|
||||
systemctl enable nginx-system --now >> $LOG
|
||||
check_result $? "nginx start failed"
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
||||
Reference in New Issue
Block a user