Update 'Apache-Installer.sh'

This commit is contained in:
2018-09-07 11:23:50 +00:00
parent c3fd748f50
commit af2466c91b

View File

@@ -58,7 +58,7 @@ systemctl restart apache2
apt-get install phpmyadmin -y apt-get install phpmyadmin -y
ln -s /usr/share/phpmyadmin /var/www/"$domain"/public_html ln -s /usr/share/phpmyadmin /var/www/"$domain"/public_html
systemctl restart php7.2-fpm systemctl restart apache2
# 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
@@ -82,36 +82,45 @@ newaliases
# NETDATA # # NETDATA #
#-------------------# #-------------------#
bash <(curl -Ss https://my-netdata.io/kickstart.sh) if [ $netdata = 1 ]
ufw allow 19999/tcp then
# systemctl stop netdata bash <(curl -Ss https://my-netdata.io/kickstart.sh)
# systemctl disable netdata ufw allow 19999/tcp
# systemctl stop netdata
# systemctl disable netdata
fi
#-------------------# #-------------------#
# MEMCACHED # # MEMCACHED #
# 127.0.0.1:11211 # # 127.0.0.1:11211 #
#-------------------# #-------------------#
#apt-get install memcached -y if [ $memcached = 1 ]
#systemctl restart memcached then
# systemctl stop memcached apt-get install memcached -y
# systemctl disable memcached systemctl restart memcached
# systemctl stop memcached
# systemctl disable memcached
fi
#-------------------# #-------------------#
# REDIS # # REDIS #
# 127.0.0.1:6379 # # 127.0.0.1:6379 #
#-------------------# #-------------------#
#apt install redis-server -y if [ $redis = 1 ]
#sed -i 's/supervised no/supervised systemd/g' /etc/redis/redis.conf then
#sed -i 's/# bind 127.0.0.1 ::1/bind 127.0.0.1 ::1/g' /etc/redis/redis.conf apt install redis-server -y
#sed -i 's/# requirepass foobared/requirepass '$passwd'/g' /etc/redis/redis.conf sed -i 's/supervised no/supervised systemd/g' /etc/redis/redis.conf
#systemctl restart redis sed -i 's/# bind 127.0.0.1 ::1/bind 127.0.0.1 ::1/g' /etc/redis/redis.conf
#systemctl restart redis.service sed -i 's/# requirepass foobared/requirepass '$passwd'/g' /etc/redis/redis.conf
# systemctl stop redis systemctl restart redis
# systemctl stop redis.service systemctl restart redis.service
# systemctl disable redis # systemctl stop redis
# systemctl disable redis.service # systemctl stop redis.service
# systemctl disable redis
# systemctl disable redis.service
fi
#-------------------# #-------------------#
# CERTBOT # # CERTBOT #
@@ -119,7 +128,10 @@ ufw allow 19999/tcp
add-apt-repository ppa:certbot/certbot add-apt-repository ppa:certbot/certbot
apt install python-certbot-apache -y apt install python-certbot-apache -y
ufw allow 443/tcp #certbot --apache -d $domain -d www.$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#include /etc/letsencrypt/options-ssl-apache.conf;#ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;#g' /etc/apache2/sites-available/"$domain"
#-------------------# #-------------------#
# PHP.ini # # PHP.ini #
@@ -134,67 +146,25 @@ sed -i 's/;opcache.revalidate_freq=2/opcache.revalidate_freq=0/g' /etc/php/7.2/a
sed -i 's/; max_input_vars = 1000/max_input_vars = 10000/g' /etc/php/7.2/apache2/php.ini sed -i 's/; max_input_vars = 1000/max_input_vars = 10000/g' /etc/php/7.2/apache2/php.ini
systemctl restart apache2 systemctl restart apache2
#-------------------#
# MYSQL SETTINGS #
#-------------------#
rm /etc/mysql/my.cnf
cat > /etc/mysql/my.cnf <<- "EOF"
# - "/etc/mysql/my.cnf" to set global options,
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
innodb_buffer_pool_size = 1G # (adjust value here, 50%-70% of total RAM)
innodb_log_file_size = 256M
innodb_flush_log_at_trx_commit = 1 # may change to 2 or 0
innodb_flush_method = O_DIRECT
bind-address = 127.0.0.1
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover-options = BACKUP
#max_connections = 100
#table_open_cache = 64
#thread_concurrency = 10
query_cache_limit = 1M
query_cache_size = 16M
log_error = /var/log/mysql/error.log
expire_logs_days = 10
max_binlog_size = 100M
EOF
#-------------------# #-------------------#
# WP - INSTALL # # WP - INSTALL #
#-------------------# #-------------------#
db_name="wp_1" if [$wordpress = 1]
db_user="wp_1" then
db_pass=$(date +%s|sha256sum|base64|head -c 32) db_name="wp_1"
mysql -u root -p"$passwd" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" db_user="wp_1"
mysql -u root -p"$passwd" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';" db_pass=$(date +%s|sha256sum|base64|head -c 32)
mysql -u root -p"$passwd" -e "FLUSH PRIVILEGES;" mysql -u root -p"$passwd" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
cd /tmp mysql -u root -p"$passwd" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';"
curl -LO https://wordpress.org/latest.tar.gz mysql -u root -p"$passwd" -e "FLUSH PRIVILEGES;"
tar xzvf latest.tar.gz wget https://wordpress.org/latest.tar.gz -O /tmp/wp.tar.gz
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php tar xzvf /tmp/wp.tar.gz /tmp
path="$domain" mv /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
cp -a /tmp/wordpress/. /var/www/"$path"/public_html cp -a /tmp/wordpress/. /var/www/"$domain"/public_html
chown -R www-data:www-data /var/www/"$path"/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 -)
cat <<EOF > /var/www/"$domain"/public_html/wp-config.php cat <<EOF > /var/www/"$domain"/public_html/wp-config.php
<?php <?php
define('DB_NAME', '$db_name'); define('DB_NAME', '$db_name');
define('DB_USER', '$db_user'); define('DB_USER', '$db_user');
@@ -235,19 +205,7 @@ if ( !defined('ABSPATH') )
#define('WP_REDIS_PORT', '6379'); #define('WP_REDIS_PORT', '6379');
require_once(ABSPATH . 'wp-settings.php'); require_once(ABSPATH . 'wp-settings.php');
EOF EOF
fi
#-------------------#
# SSL & HTTP/2 #
#-------------------#
#certbot --apache -d $domain -d www.$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#include /etc/letsencrypt/options-ssl-apache.conf;#ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;#g' /etc/apache2/sites-available/"$domain"
#check certbot auto-renewal -> certbot renew --dry-run
#Edit voor https, voeg het volgende toe aan $domain-le-ssl.conf tussen DocumentRoot en ErrorLog #Edit voor https, voeg het volgende toe aan $domain-le-ssl.conf tussen DocumentRoot en ErrorLog
#<Directory "/var/www/videoguard.ictmaatwerk.com/public_html"> #<Directory "/var/www/videoguard.ictmaatwerk.com/public_html">
# Options FollowSymLinks # Options FollowSymLinks
@@ -255,4 +213,4 @@ EOF
# #
# Order allow,deny # Order allow,deny
# Allow from all # Allow from all
# </Directory> # </Directory>