22# #################################################################################
33# <START METADATA>
44# @file_name: vstacklet-server-stack.sh
5- # @version: 3.1.2176
5+ # @version: 3.1.2177
66# @description: Lightweight script to quickly install a LEMP stack with Nginx,
77# Varnish, PHP7.4/8.1/8.3 (PHP-FPM), OPCode Cache, IonCube Loader, MariaDB, Sendmail
88# and more on a fresh Ubuntu 20.04/22.04 or Debian 11/12 server for
@@ -481,9 +481,12 @@ vstacklet::args::process() {
481481 [[ (-z ${php} ) && (-z ${hhvm} ) ]] && vstacklet::shell::text::error " WordPress requires a php version to be installed." && exit 1
482482 fi
483483 if [[ -n ${domain_ssl} ]]; then
484+ # @script-note: check if nginx and/or php is installed
485+ nginx_installed=$( dpkg-query -W -f=' ${Status}' nginx 2> /dev/null | grep -c " ok installed" )
486+ php_installed=$( ls -d /etc/php/* 2> /dev/null | wc -l)
484487 [[ -z ${email} ]] && vstacklet::shell::text::error " please provide an email address with \` -e\` ." && exit 1
485- [[ -z ${nginx} ]] && vstacklet::shell::text::error " please install nginx with \` -nginx\` ." && exit 1
486- [[ -z ${php} ]] && vstacklet::shell::text::error " please install php with \` -php \" 7.4\"\` , \` -php \" 8.1\"\` or \` -php \" 8.3\"\` ." && exit 1
488+ [[ -z ${nginx} && ${nginx_installed} -eq 0 ]] && vstacklet::shell::text::error " nginx is required to install an SSL certificate. please install nginx with \` -nginx\` ." && exit 1
489+ [[ -z ${php} && ${php_installed} -eq 0 ]] && vstacklet::shell::text::error " php is required to install an SSL certificate. please install php with \` -php \" 7.4\"\` , \` -php \" 8.1\"\` or \` -php \" 8.3\"\` ." && exit 1
487490 fi
488491 [[ ${php} == * " 7" * ]] && declare -g php=" 7.4"
489492 [[ ${php} == * " 8.1" * ]] && declare -g php=" 8.1"
@@ -494,20 +497,20 @@ vstacklet::args::process() {
494497 fi
495498 [[ ${# invalid_option[@]} -gt 0 ]] && vstacklet::shell::text::error " invalid option(s): ${invalid_option[*]} " && exit 1
496499 # @script-note: set default arguments on options
497- [[ -z ${csf_ui_port} ]] && declare -gi csf_ui_port=" 1043"
498- [[ -z ${ftp_port} ]] && declare -gi ftp_port=" 21"
499- [[ -z ${https_port} ]] && declare -gi https_port=" 443"
500- [[ -z ${http_port} ]] && declare -gi http_port=" 80"
501- [[ -z ${mariadb_port} ]] && declare -gi mariadb_port=" 3306"
502- [[ -z ${mysql_port} ]] && declare -gi mysql_port=" 3306"
503- [[ -z ${postgresql_port} ]] && declare -gi postgresql_port=" 5432"
504- [[ -z ${php} ]] && declare -g php=" 8.1"
505- [[ -z ${redis_port} ]] && declare -gi redis_port=" 6379"
506- [[ -z ${sendmail_port} ]] && declare -gi sendmail_port=" 587"
507- [[ -z ${ssh_port} ]] && declare -gi ssh_port=" 22"
508- [[ -z ${varnish_port} ]] && declare -gi varnish_port=" 6081"
509- [[ -z ${varnish_https_port} ]] && declare -gi varnish_https_port=" 8443"
510- [[ -z ${web_root} ]] && declare -g web_root=" /var/www/html/vsapp"
500+ # [[ -z ${csf_ui_port} ]] && declare -gi csf_ui_port="1043"
501+ # [[ -z ${ftp_port} ]] && declare -gi ftp_port="21"
502+ # [[ -z ${https_port} ]] && declare -gi https_port="443"
503+ # [[ -z ${http_port} ]] && declare -gi http_port="80"
504+ # [[ -z ${mariadb_port} ]] && declare -gi mariadb_port="3306"
505+ # [[ -z ${mysql_port} ]] && declare -gi mysql_port="3306"
506+ # [[ -z ${postgresql_port} ]] && declare -gi postgresql_port="5432"
507+ # [[ -z ${php} ]] && declare -g php="8.1"
508+ # [[ -z ${redis_port} ]] && declare -gi redis_port="6379"
509+ # [[ -z ${sendmail_port} ]] && declare -gi sendmail_port="587"
510+ # [[ -z ${ssh_port} ]] && declare -gi ssh_port="22"
511+ # [[ -z ${varnish_port} ]] && declare -gi varnish_port="6081"
512+ # [[ -z ${varnish_https_port} ]] && declare -gi varnish_https_port="8443"
513+ # [[ -z ${web_root} ]] && declare -g web_root="/var/www/html/vsapp"
511514}
512515
513516# #################################################################################
0 commit comments