Compare commits

...

3 Commits

1 changed files with 26 additions and 10 deletions

View File

@ -2,7 +2,7 @@
#SETTINGS #SETTINGS
passlen=22 passlen=22
emailforle="putyouremailaddresshere@domain.com" emailforle=""
#FUNCTIONS #FUNCTIONS
function errorcheck { function errorcheck {
@ -92,6 +92,13 @@ function gathersettings {
echo "IP address is $ipaddress..." echo "IP address is $ipaddress..."
echo -n "What is the FQDN for the server? " echo -n "What is the FQDN for the server? "
read fqdn read fqdn
echo -n "Do you want to configure the system hostname the same as the FQDN? (y/n)"
read reply
if [[ $reply == "y" ]]; then
sethost=true
else
sethost=false
fi
echo -n "Must an SLL certificate be used? (y/n)" echo -n "Must an SLL certificate be used? (y/n)"
read reply read reply
if [[ $reply == "y" ]]; then if [[ $reply == "y" ]]; then
@ -144,6 +151,9 @@ function gathersettings {
if [[ $mailfrom == "" ]]; then if [[ $mailfrom == "" ]]; then
mailfrom=$mailuser mailfrom=$mailuser
fi fi
if [[ $emailforle == "" ]]; then
emailforle=$mailfrom
fi
echo -n "What is the sender name for the mailserver? " echo -n "What is the sender name for the mailserver? "
read mailname read mailname
echo echo
@ -218,13 +228,15 @@ function applysettings {
function sethostname { function sethostname {
#SETTING UP HOSTNAME #SETTING UP HOSTNAME
echo "Setting up hostname..." if [[ $sethost == true ]]; then
hostnamectl set-hostname ${fqdn%%.*} > /dev/null 2>&1 echo "Setting up hostname..."
errorcheck $? "define hostname" "EXIT" hostnamectl set-hostname ${fqdn%%.*} > /dev/null 2>&1
echo "$ipaddress $fqdn ${fqdn%%.*}" >> /etc/hosts errorcheck $? "define hostname" "EXIT"
errorcheck $? "define FQDN" "EXIT" echo "$ipaddress $fqdn ${fqdn%%.*}" >> /etc/hosts
echo "1" > "$origpath/setupninja.step" errorcheck $? "define FQDN" "EXIT"
echo echo "1" > "$origpath/setupninja.step"
echo
fi
} }
function initsetup { function initsetup {
@ -279,8 +291,8 @@ function gomariadb {
function gophp { function gophp {
#INSTALL PHP #INSTALL PHP
echo "Install PHP8.2..." echo "Install PHP8.2..."
apt -y install php8.2-{fpm,soap,bcmath,common,imagick,mysql,gmp,curl,intl,mbstring,xmlrpc,gd,xml,cli,zip,bz2,fpm} libapache2-mod-php libapache2-mod-fcgid > /dev/null 2>&1 apt -y install php8.2-{fpm,soap,bcmath,common,imagick,mysql,gmp,curl,intl,mbstring,xmlrpc,gd,xml,cli,zip,bz2,fpm} libapache2-mod-php8.2 libapache2-mod-fcgid > /dev/null 2>&1
errorcheck $? "apt -y install php8.2-{fpm,soap,bcmath,common,imagick,mysql,gmp,curl,intl,mbstring,xmlrpc,gd,xml,cli,zip,bz2,fpm} libapache2-mod-php libapache2-mod-fcgid" "EXIT" errorcheck $? "apt -y install php8.2-{fpm,soap,bcmath,common,imagick,mysql,gmp,curl,intl,mbstring,xmlrpc,gd,xml,cli,zip,bz2,fpm} libapache2-mod-php8.2 libapache2-mod-fcgid" "EXIT"
echo "7" > "$origpath/setupninja.step" echo "7" > "$origpath/setupninja.step"
echo echo
} }
@ -440,6 +452,10 @@ function vhostninja {
echo " Require all granted" >> /etc/apache2/sites-available/$appdbname.conf echo " Require all granted" >> /etc/apache2/sites-available/$appdbname.conf
echo " </Directory>" >> /etc/apache2/sites-available/$appdbname.conf echo " </Directory>" >> /etc/apache2/sites-available/$appdbname.conf
echo "" >> /etc/apache2/sites-available/$appdbname.conf echo "" >> /etc/apache2/sites-available/$appdbname.conf
echo " <FilesMatch \.php$>" >> /etc/apache2/sites-available/$appdbname.conf
echo " SetHandler \"proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost\"" >> /etc/apache2/sites-available/$appdbname.conf
echo " </FilesMatch>" >> /etc/apache2/sites-available/$appdbname.conf
echo "" >> /etc/apache2/sites-available/$appdbname.conf
echo " ErrorLog ${APACHE_LOG_DIR}/$appdbname_error.log" >> /etc/apache2/sites-available/$appdbname.conf echo " ErrorLog ${APACHE_LOG_DIR}/$appdbname_error.log" >> /etc/apache2/sites-available/$appdbname.conf
echo " CustomLog ${APACHE_LOG_DIR}/$appdbname_access.log combined" >> /etc/apache2/sites-available/$appdbname.conf echo " CustomLog ${APACHE_LOG_DIR}/$appdbname_access.log combined" >> /etc/apache2/sites-available/$appdbname.conf
echo "</VirtualHost>" >> /etc/apache2/sites-available/$appdbname.conf echo "</VirtualHost>" >> /etc/apache2/sites-available/$appdbname.conf