Update nginx_install.sh, nginxDefault, and 3 more files...

learned how to use functions and colors
This commit is contained in:
mrjohndowe 2021-11-28 04:51:58 -07:00
parent 6468fac453
commit 38af383056
5 changed files with 107 additions and 14 deletions

View File

@ -53,6 +53,10 @@ server {
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
}
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
@ -68,10 +72,7 @@ server {
#location ~ /\.ht {
# deny all;
#}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
}
}

View File

@ -69,7 +69,7 @@ echo "Would you like to run the main installation file again? (Y/n) | " ; read A
clear;
if($ANSWER == "Y" || $ANSWER == "y" || $ANSWER == "yes" || $ANSWER == "YES")
then exec ../init.sh;
else
else
echo "Goodbye";
sleep 1;
clear;

View File

@ -1,2 +1,68 @@
#!bin/bash
#
Color_Off='\033[0m' # Reset
# Regular Colors
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
Blue='\033[0;34m' # Blue
Purple='\033[0;35m' # Purple
Cyan='\033[0;36m' # Cyan
files=".doweFiles"
update() {
# Update system repos
echo -e "\n ${Cyan} Updating package repositories.. ${Color_Off}"
sudo apt -qq update
}
installPHP(){
echo -e "\n ${Cyan} Installing PHP and common Modules.. ${Color_Off}";
sudo apt -qy install php8.0-sqlite3 php8.0-fpm php8.0-mbstring php8.0-mysql php8.0-curl php8.0-gd php8.0-curl php8.0-zip php8.0-xml php8.0-bz2 php8.0-intl php-smbclient php8.0-imap php8.0-gmp libapache2-mod-php8.0;
}
installMyAdmin(){
echo -e "\n ${Cyan} Installing PHPMyAdmin and common Modules.. ${Color_Off}";
sudo apt-get install phpmyadmin -y;
sudo ln -s /usr/share/phpmyadmin /var/www/html
}
setPermissions() {
# Permissions
echo -e "\n ${Cyan} Setting Ownership for /var/www.. ${Color_Off}"
sudo chown -R www-data:www-data /var/www
}
copyPHPini(){
echo -e "\n ${Yellow} Copying Files.. ${Color_Off}"
cd $doweFiles;
sudo cp php.ini >> /etc/php/8.0/fpm/php.ini -y;
sudo cp nginxDefault /etc/nginx/sites-enabled/default -y;
cd ../
}
restartWebServer() {
# Restart NGINX
echo -e "\n ${Cyan} Restarting NGINX.. ${Color_Off}"
sudo service nginx restart
}
restartAll(){
echo -e "\n ${Yellow} Restarting All Services.. ${Color_Off}"
sudo service nginx stop; service php8.0-fpm force-reload; service nginx start;
}
#RUN
update
installPHP
installMyAdmin
copyPHPini
setPermissions
restartWebServer
restartAll
echo -e "\n${Green} SUCCESS! MySQL password is: ${PASS_MYSQL_ROOT} ${Color_Off}"

14
cheatsheet.txt Normal file
View File

@ -0,0 +1,14 @@
sudo apt-get install php8.0-sqlite3 php8.0-fpm php8.0-mbstring php8.0-mysql php8.0-curl php8.0-gd php8.0-curl php8.0-zip php8.0-xml php8.0-bz2 php8.0-intl php-smbclient php8.0-imap php8.0-gmp libapache2-mod-php8.0 -y
GRANT ALL PRIVILEGES ON *.* TO 'mrjohndowe' IDENTIFIED BY '53nrw695' WITH GRANT OPTION;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'YoX~AFC2TV$z7X#+Vp*9';
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'YoX~AFC2TV$z7X#+Vp*9';
service nginx stop; service php8.0-fpm force-reload; service nginx start;
service nginx stop; service php8.0-fpm stop; service php8.0-fpm force-reload; service php8.0-fpm start; service nginx start;
#sudo apt-get install php8.0-sqlite3 php8.0-fpm php8.0-mbstring php8.0-mysql php8.0-curl php8.0-gd php8.0-curl php8.0-zip php8.0-xml php8.0-bz2 php8.0-intl php-smbclient php8.0-imap php8.0-gmp libapache2-mod-php8.0 -y;

26
init.sh
View File

@ -1,6 +1,16 @@
#!/bin/sh
#
Color_Off='\033[0m' # Reset
# Regular Colors
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
Blue='\033[0;34m' # Blue
Purple='\033[0;35m' # Purple
Cyan='\033[0;36m' # Cyan
###### VARIABLES ########
webserver="nginx"
@ -9,6 +19,7 @@ doweFiles=".doweFiles"
phpVersion="8.0"
mysql="mysql_install.sh"
nginx="nginx_install.sh"
phpmyadmin="phpmyadmin_installation.sh"
###### END VARIABLES ######
@ -16,24 +27,25 @@ nginx="nginx_install.sh"
sudo clear;
echo "Welcome to the Dowe Server Files Installation....";
echo "Please enter the name of the file you would like to install";
echo -n "Options are: [1] NGINX, [2] PHP${phpVersion}, [3] MySql, [4] SQLite3, [5] Gittea | ";
echo -n "Options are: [1] NGINX, [2] MySql, [3] SQLite3, [4] PHPMyAdmin, [5] Gittea, [0] Install All | ";
read OPTION;
case $OPTION in
1)
echo -n $webserver;;
2)
echo -n "PHP \n";;
3)
exec $doweFiles/$mysql;;
4)
exec $doweFiles/$phpmyadmin;;
2)
exec $doweFiles/$mysql;;
3)
echo -n "SQLite3";;
5)
echo -n "Gittea";;
0)
echo -n "Install All";;
*)
echo -n "Option not available...";;
echo -n "\n ${Red} ERROR: Option $OPTION not available...${Color_Off}\n";;
esac