Update 'NGINX-Installer_V0.1.sh'

This commit is contained in:
2018-09-07 11:06:51 +00:00
parent a2570a18ba
commit 6ffad731c2

View File

@@ -260,9 +260,7 @@ apt-get install phpmyadmin -y
ln -s /usr/share/phpmyadmin /var/www/"$domain"/html ln -s /usr/share/phpmyadmin /var/www/"$domain"/html
systemctl restart php7.2-fpm systemctl restart php7.2-fpm
# Redirect phpmyadmin -> database # Redirect phpmyadmin -> database
cd /var/www/"$domain"/html/ mv /var/www/"$domain"/html/phpmyadmin /var/www/"$domain"/html/database
ls -l
mv phpmyadmin database
#-------------------# #-------------------#
# POSTFIX # # POSTFIX #
@@ -283,38 +281,42 @@ newaliases
#-------------------# #-------------------#
# NETDATA # # NETDATA #
#-------------------# #-------------------#
if [$netdata = 1]
bash <(curl -Ss https://my-netdata.io/kickstart.sh) then
ufw allow 19999/tcp bash <(curl -Ss https://my-netdata.io/kickstart.sh)
# systemctl stop netdata ufw allow 19999/tcp
# systemctl disable netdata # systemctl stop netdata
# systemctl disable netdata
fi
#-------------------# #-------------------#
# MEMCACHED # # MEMCACHED #
# 127.0.0.1:11211 # # 127.0.0.1:11211 #
#-------------------# #-------------------#
if [$memcached = 1]
#apt-get install memcached -y then
#systemctl restart memcached apt-get install memcached -y
# systemctl stop memcached systemctl restart memcached
# systemctl disable memcached # systemctl stop memcached
# systemctl disable memcached
fi
#-------------------# #-------------------#
# REDIS # # REDIS #
# 127.0.0.1:6379 # # 127.0.0.1:6379 #
#-------------------# #-------------------#
if [$redis = 1]
#apt install redis-server -y then
#sed -i 's/supervised no/supervised systemd/g' /etc/redis/redis.conf apt install redis-server -y
#sed -i 's/# bind 127.0.0.1 ::1/bind 127.0.0.1 ::1/g' /etc/redis/redis.conf sed -i 's/supervised no/supervised systemd/g' /etc/redis/redis.conf
#sed -i 's/# requirepass foobared/requirepass '$passwd'/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
#systemctl restart redis sed -i 's/# requirepass foobared/requirepass '$passwd'/g' /etc/redis/redis.conf
#systemctl restart redis.service systemctl restart redis
# systemctl stop redis systemctl restart redis.service
# systemctl stop redis.service # systemctl stop redis
# systemctl disable redis # systemctl stop redis.service
# systemctl disable redis.service # systemctl disable redis
# systemctl disable redis.service
fi
#-------------------# #-------------------#
# CERTBOT # # CERTBOT #
#-------------------# #-------------------#
@@ -323,6 +325,9 @@ add-apt-repository ppa:certbot/certbot
apt install python-certbot-nginx -y apt install python-certbot-nginx -y
ufw allow 443/tcp ufw allow 443/tcp
#certbot --nginx -d $domain -d www.$domain #certbot --nginx -d $domain -d www.$domain
#sed -i 's/ssl ipv6only/ssl http2 ipv6only/g' /etc/nginx/sites-available/"$domain"
#sed -i 's/listen 443 ssl/listen 443 ssl http2/g' /etc/nginx/sites-available/"$domain"
#sed -i 's#include /etc/letsencrypt/options-ssl-nginx.conf;#ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;#g' /etc/nginx/sites-available/"$domain"
#check certbot auto-renewal -> certbot renew --dry-run #check certbot auto-renewal -> certbot renew --dry-run
#-------------------# #-------------------#
@@ -342,7 +347,6 @@ systemctl restart php7.2-fpm.service
# MYSQL SETTINGS # # MYSQL SETTINGS #
#-------------------# #-------------------#
cd /etc/mysql
rm /etc/mysql/my.cnf rm /etc/mysql/my.cnf
cat > /etc/mysql/my.cnf <<- "EOF" cat > /etc/mysql/my.cnf <<- "EOF"
# - "/etc/mysql/my.cnf" to set global options, # - "/etc/mysql/my.cnf" to set global options,
@@ -385,19 +389,21 @@ 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;"
wget https://wordpress.org/latest.tar.gz -O /tmp/wp.tar.gz mysql -u root -p"$passwd" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';"
tar xzvf /tmp/wp.tar.gz /tmp mysql -u root -p"$passwd" -e "FLUSH PRIVILEGES;"
mv /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php wget https://wordpress.org/latest.tar.gz -O /tmp/wp.tar.gz
cp -a /tmp/wordpress/. /var/www/"$domain"/html tar xzvf /tmp/wp.tar.gz /tmp
chown -R www-data:www-data /var/www/"$domain"/html mv /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -) cp -a /tmp/wordpress/. /var/www/"$domain"/html
cat <<EOF > /var/www/"$domain"/html/wp-config.php chown -R www-data:www-data /var/www/"$domain"/html
WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -)
cat <<EOF > /var/www/"$domain"/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');
@@ -438,12 +444,4 @@ 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 --nginx -d $domain -d www.$domain
#sed -i 's/ssl ipv6only/ssl http2 ipv6only/g' /etc/nginx/sites-available/"$domain"
#sed -i 's/listen 443 ssl/listen 443 ssl http2/g' /etc/nginx/sites-available/"$domain"
#sed -i 's#include /etc/letsencrypt/options-ssl-nginx.conf;#ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;#g' /etc/nginx/sites-available/"$domain"