comment corrections only no code changes

This commit is contained in:
2025-12-06 11:41:39 +01:00
parent 03398740b1
commit c5a0a7f81e

View File

@@ -12,13 +12,13 @@
if [[ $(id -u) -ne 0 ]]; then echo "" && echo "Must be root or use sudo" && echo "" ; exit 1 ; fi
#
# Get php-fpm version
# Detect PHP-FPM version
#
phpfpm=$(systemctl list-unit-files --type=service | awk '/php[0-9]+\.[0-9]+-fpm\.service/ {sub(".service","",$1); print $1; exit}')
if [[ -z "$phpfpm" ]]; then printf "\nUnable to detect php-fpm version. Is PHP-FPM installed?\n\n" ; exit 1 ; fi
if [[ -z "$phpfpm" ]]; then printf "\nUnable to detect PHP-FPM version. Is PHP-FPM installed?\n\n" ; exit 1 ; fi
#
# Check if required services are running or not
# Check if required services are running
#
for svc in nginx mariadb "$phpfpm"; do systemctl is-active --quiet "$svc" || { printf "\n%s is not running, cannot continue...\n\n" "${svc^}" ; exit 1 ; }; done
@@ -104,7 +104,7 @@ done
if [[ -z "$hostname" || -z "$dbname" || -z "$dbuser" || -z "$dbpass" ]]; then
usage
printf "\nERROR: Missing required arguments.\n"
printf "Hostname (-n), Database name (-d), User (-u), and Password (-p) are mandatory.\n\n"
printf "Hostname (-n), Database name (-d), User (-u), and Password (-p) are required.\n\n"
exit 1
fi
@@ -154,7 +154,7 @@ fi
# Check for spaces in DB credentials
if [[ "$dbname" =~ [[:space:]] || "$dbuser" =~ [[:space:]] || "$dbpass" =~ [[:space:]] ]]; then
printf "\nERROR: Database name, user, and password cannot contain spaces.\n\n"
printf "\nERROR: Database name, user, and password cannot contain whitespace.\n\n"
exit 1
fi
@@ -183,7 +183,7 @@ if [[ "$socketauth" == "no" ]]; then
fi
#
# Set permisions on Wordpress directory
# Set permissions on WordPress directory
#
chown -R www-data: "$wptarget"
@@ -202,7 +202,7 @@ sed -i -- "s/DOMAIN/$hostname/g" /etc/nginx/conf.d/"$hostname".conf
sed -i "s/PHPVERSION/$phpfpm/" /etc/nginx/conf.d/"$hostname".conf
#
# Wordpress hardeging
# WordPress hardeging
#
mkdir -p /etc/nginx/includes
cp "$nginxsnippets/wp-hardening.conf" /etc/nginx/includes/wp-hardening.conf
@@ -262,20 +262,20 @@ EOF
esac
#
# Restarting Nginx and Phpfpm for changes to take effect
# Restarting Nginx and PHP-FPM for changes to take effect
#
printf "\nRestarting services...\n"
systemctl restart "$phpfpm"
systemctl restart nginx
#
# Wordpress notice
# WordPress notice
#
wpnotice=$(cat <<EOF
-----------------------------------------------------------------------------------
IMPORTANT:
Go to http://$hostname/wp-admin/install.php and complete the setup
Go to http://$hostname/wp-admin/install.php and complete the WordPress setup
-----------------------------------------------------------------------------------
EOF
)