#============================================================================== # UBUNTU 18.04 BASH SCRIPT #============================================================================== # top -o %MEM -> See Memory consumption # apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y # do-release-upgrade -d # # BENCHMARK # wget freevps.us/downloads/bench.sh -O - -o /dev/null|bash # wget –no-check-certificate https://vhwinfo.com/vhwinfo.sh -O - -o /dev/null|bash # # NGINX LOG -->> tail -n 100 /var/log/nginx/error.log # RSYNC -->> sshpass -p 'passwd' rsync /tmp/backups/. root@51.68.230.92:/tmp --delete -av --ignore-existing # WGET .SH -->> http://sitehere.com/install.sh -v -O install.sh && ./install.sh; rm -rf install.sh # #============================================================================== # UNDER DEVELOPMENT #============================================================================== # #============================================================================== # CHECKEN! # > #============================================================================== echo Welk domein mag gekoppeld worden? Typ domein zonder www read domain echo Standaard wachtwoord read passwd echo administrator email read email apt-get update apt-get upgrade -y apt-get dist-upgrade -y apt-get clean apt-get autoremove -y hostnamectl set-hostname $domain sed -i 's/;preserve_hostname: false/preserve_hostname: true/g' /etc/cloud/cloud.cfg timedatectl set-timezone Europe/Amsterdam ufw allow OpenSSH ufw allow 443/tcp ufw allow 80/tcp ufw limit ssh echo "y" | sudo ufw enable sed -i 's/#/vm.swappiness=10/g' /etc/sysctl.conf sed -i 's/#/vm.vfs_cache_pressure=50/g' /etc/sysctl.conf #-------------------# # LAMP # #-------------------# install apache2 -y apt install mysql-server-5.7 -y mysql_secure_installation mysql -u root -p"$passwd" -e "SELECT user,authentication_string,plugin,host FROM mysql.user;" mysql -u root -p"$passwd" -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '"$passwd"';" mysql -u root -p"$passwd" -e "FLUSH PRIVILEGES;" mysql -u root -p"$passwd" -e "SELECT user,authentication_string,plugin,host FROM mysql.user;" apt install libapache2-mod-php php-fpm php-mysql php-cgi php-common php-pear php-mbstring php-curl php-gd php-intl php-soap php-xml php-xmlrpc php-zip -y cat < /etc/apache2/mods-enabled/dir.conf DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm EOF systemctl restart apache2 systemctl status apache2 #-------------------# # VIRTUAL HOST # #-------------------# rm /var/www/html mkdir -p /var/www/"$domain"/public_html chmod -R 755 /var/www cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/"$domain".conf cat < /etc/apache2/sites-available/"$domain".conf ServerAdmin $email ServerName $domain ServerAlias www.$domain DocumentRoot /var/www/$domain/public_html ErrorLog \${APACHE_LOG_DIR}/error.log CustomLog \${APACHE_LOG_DIR}/access.log combined EOF a2ensite $domain.conf a2dissite 000-default.conf systemctl restart apache2