diff --git a/installer.sh b/installer.sh index e1d82be..1c338f8 100644 --- a/installer.sh +++ b/installer.sh @@ -49,14 +49,36 @@ echo "Administrator email:" read email echo "Webserver:" PS3='Keuze:' -options=("Apache" "Nginx proxy" "Nginx proxy & standalone" "Nginx, PHP-FPM" "Quit") +options=("Nginx, PHP-FPM" "Apache" "Other" "Quit") select opt in "${options[@]}" do case $opt in + "Nginx, PHP-FPM") + webserv=n + newsql=1 + script=https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/NGINX-Installer.sh + break;; "Apache") webserv=a + newsql=1 script=https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/Apache-Installer.sh break;; + "Other") + webserv=o + break;; + "Quit") + exit;; + *) echo "Fout commando $REPLY";; + esac +done + + +if [ $webserv = o ]; then +PS3='Keuze:' +options=( "Nginx proxy" "Nginx proxy & standalone") +select opt in "${options[@]}" +do + case $opt in "Nginx proxy") webserv=np script=https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/RevProxySimple.sh @@ -65,15 +87,16 @@ do webserv=nps script=https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/RevProxyAdvanced.sh break;; - "Nginx, PHP-FPM") - webserv=n - script=https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/NGINX-Installer.sh - break;; - "Quit") - exit;; *) echo "Fout commando $REPLY";; esac done +fi + + +if [ $webserv = n ]; then + + + while true; do read -p "Password login uit zetten -> yes/no?" yn @@ -124,8 +147,6 @@ else nextcloud=0 fi -cockpit=1 - while true; do read -p "Installeer Memcached -> yes/no?" yn case $yn in @@ -164,6 +185,8 @@ done ##-----------------## phpver=7.3 +sqlver=8.0 #or 5.7 +cockpit=1 ##----------------## # Pre-Config # @@ -219,18 +242,18 @@ apt install fail2ban -y # Install Phase # ##-------------------## -echo "****************************" -sleep 0.5 -echo "Installatie duurt 5 minuten." -sleep 0.5 -echo "****************************" - wget $script -O Ubuntu-Web_Installer.sh source Ubuntu-Web_Installer.sh -##------------------## -# MySQL Config # -##------------------## +##-----------## +# MySQL # +##-----------## + + +if [ $newsql = 1 ]; then + wget https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/mysql-${sqlver}.sh -O Mysql-Installer.sh + source Mysql-Installer.sh +fi rm /etc/mysql/my.cnf cat > /etc/mysql/my.cnf <<- "EOF" @@ -279,17 +302,70 @@ if [ $cockpit = 1 ]; then source Slave-Installer.sh fi - - if [ $sshkey = 1 ]; then sed -i 's/PermitRootLogin yes/PermitRootLogin prohibit-password/g' /etc/ssh/sshd_config fi -##------------------------## -# PHP-Myadmin update # -##------------------------## +##---------------## +# Wordpress # +##---------------## -bash <(curl -s https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/PHPMyAdmin_Updater.sh) +if [ $wordpress = 1 ]; then + db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1` + db_name="wp_$db_suffix" + db_user="wp_$db_suffix" + db_pass=$(date +%s|sha256sum|base64|head -c 32) + mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" + mysql -u root -p"$password" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';" + mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" + wget https://wordpress.org/latest.tar.gz -O /tmp/wp.tar.gz + tar xzvf /tmp/wp.tar.gz -C /tmp + mv /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php + cp -a /tmp/wordpress/. /var/www/"$domain"/html + WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -) +cat < /var/www/"$domain"/html/wp-config.php + array( +# '127.0.0.1:11211' +# ) +#); +#define('WP_REDIS_HOST', '127.0.0.1'); +#define('WP_REDIS_PASSWORD', '$password'); +#define('WP_REDIS_PORT', '6379'); +require_once(ABSPATH . 'wp-settings.php'); +EOF +fi ##-------------------## # Backup Script #