'Apache-Installer.sh' updaten

This commit is contained in:
ictmaatwerk
2018-09-12 13:10:55 +00:00
parent 1ad4244133
commit 106b4884ab

View File

@@ -14,7 +14,7 @@
# LAMP # # LAMP #
#-------------------# #-------------------#
apt install apache2 mysql-server-5.7 -y apt install -y apache2 mysql-server-5.7
mysql_secure_installation mysql_secure_installation
mysql -u root -p"$passwd" -e "SELECT user,authentication_string,plugin,host FROM mysql.user;" 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 "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '"$passwd"';"
@@ -55,7 +55,7 @@ systemctl restart apache2
# PHPMYADMIN # # PHPMYADMIN #
#-------------------# #-------------------#
apt-get install phpmyadmin -y apt install -y phpmyadmin
ln -s /usr/share/phpmyadmin /var/www/"$domain"/public_html ln -s /usr/share/phpmyadmin /var/www/"$domain"/public_html
# Redirect phpmyadmin -> database # Redirect phpmyadmin -> database
mv /var/www/"$domain"/public_html/phpmyadmin /var/www/"$domain"/public_html/database mv /var/www/"$domain"/public_html/phpmyadmin /var/www/"$domain"/public_html/database
@@ -66,7 +66,9 @@ systemctl restart apache2
# POSTFIX # # POSTFIX #
#-------------------# #-------------------#
apt install mailutils -y debconf-set-selections <<< "postfix postfix/mailname string $domain"
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
apt install -y mailutils
sed -i 's/#inet_interfaces = all/inet_interfaces = loopback-only/g' /etc/postfix/main.cf sed -i 's/#inet_interfaces = all/inet_interfaces = loopback-only/g' /etc/postfix/main.cf
sed -i 's/mydestination/#mydestination/g' /etc/postfix/main.cf sed -i 's/mydestination/#mydestination/g' /etc/postfix/main.cf
sed -i 's/relayhost =/mydestination = '$domain', localhost.'$domain', '$domain'/g' /etc/postfix/main.cf sed -i 's/relayhost =/mydestination = '$domain', localhost.'$domain', '$domain'/g' /etc/postfix/main.cf
@@ -84,7 +86,7 @@ newaliases
if [ $netdata = 1 ] if [ $netdata = 1 ]
then then
bash <(curl -Ss https://my-netdata.io/kickstart.sh) apt install -y netdata
ufw allow 19999/tcp ufw allow 19999/tcp
# systemctl stop netdata # systemctl stop netdata
# systemctl disable netdata # systemctl disable netdata
@@ -97,7 +99,7 @@ fi
if [ $memcached = 1 ] if [ $memcached = 1 ]
then then
apt-get install memcached -y apt install -y memcached
systemctl restart memcached systemctl restart memcached
# systemctl stop memcached # systemctl stop memcached
# systemctl disable memcached # systemctl disable memcached
@@ -110,7 +112,7 @@ fi
if [ $redis = 1 ] if [ $redis = 1 ]
then then
apt install redis-server -y apt install -y redis-server
sed -i 's/supervised no/supervised systemd/g' /etc/redis/redis.conf sed -i 's/supervised no/supervised systemd/g' /etc/redis/redis.conf
sed -i 's/# bind 127.0.0.1 ::1/bind 127.0.0.1 ::1/g' /etc/redis/redis.conf sed -i 's/# bind 127.0.0.1 ::1/bind 127.0.0.1 ::1/g' /etc/redis/redis.conf
sed -i 's/# requirepass foobared/requirepass '$passwd'/g' /etc/redis/redis.conf sed -i 's/# requirepass foobared/requirepass '$passwd'/g' /etc/redis/redis.conf
@@ -126,8 +128,8 @@ fi
# CERTBOT # # CERTBOT #
#-------------------# #-------------------#
add-apt-repository ppa:certbot/certbot add-apt-repository -y ppa:certbot/certbot
apt install python-certbot-apache -y apt install -y python-certbot-apache
#certbot --apache -d $domain -d www.$domain #certbot --apache -d $domain -d www.$domain
#sed -i 's/ssl ipv6only/ssl http2 ipv6only/g' /etc/apache2/sites-available/"$domain" #sed -i 's/ssl ipv6only/ssl http2 ipv6only/g' /etc/apache2/sites-available/"$domain"
#sed -i 's/listen 443 ssl/listen 443 ssl http2/g' /etc/apache2/sites-available/"$domain" #sed -i 's/listen 443 ssl/listen 443 ssl http2/g' /etc/apache2/sites-available/"$domain"
@@ -151,16 +153,16 @@ systemctl restart apache2
#-------------------# #-------------------#
if [ $wordpress = 1 ] if [ $wordpress = 1 ]
then then
db_name="wp_1" db_name="wp_1"
db_user="wp_1" db_user="wp_1"
db_pass=$(date +%s|sha256sum|base64|head -c 32) db_pass=$(date +%s|sha256sum|base64|head -c 32)
mysql -u root -p"$passwd" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" mysql -u root -p"$passwd" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
mysql -u root -p"$passwd" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';" mysql -u root -p"$passwd" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';"
mysql -u root -p"$passwd" -e "FLUSH PRIVILEGES;" mysql -u root -p"$passwd" -e "FLUSH PRIVILEGES;"
wget https://wordpress.org/latest.tar.gz -O /tmp/wp.tar.gz wget https://wordpress.org/latest.tar.gz -O /tmp/wp.tar.gz
tar xzvf /tmp/wp.tar.gz -C /tmp tar xzvf /tmp/wp.tar.gz -C /tmp
mv /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php mv /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
cp -a /tmp/wordpress/. /var/www/"$domain"/public_html cp -a /tmp/wordpress/. /var/www/"$domain"/public_html
chown -R www-data:www-data /var/www/"$domain"/public_html chown -R www-data:www-data /var/www/"$domain"/public_html
WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -) WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -)