Update 'NGINX-Installer_V0.1.sh'
This commit is contained in:
@@ -260,9 +260,7 @@ apt-get install phpmyadmin -y
|
||||
ln -s /usr/share/phpmyadmin /var/www/"$domain"/html
|
||||
systemctl restart php7.2-fpm
|
||||
# Redirect phpmyadmin -> database
|
||||
cd /var/www/"$domain"/html/
|
||||
ls -l
|
||||
mv phpmyadmin database
|
||||
mv /var/www/"$domain"/html/phpmyadmin /var/www/"$domain"/html/database
|
||||
|
||||
#-------------------#
|
||||
# POSTFIX #
|
||||
@@ -283,38 +281,42 @@ newaliases
|
||||
#-------------------#
|
||||
# NETDATA #
|
||||
#-------------------#
|
||||
|
||||
bash <(curl -Ss https://my-netdata.io/kickstart.sh)
|
||||
ufw allow 19999/tcp
|
||||
# systemctl stop netdata
|
||||
# systemctl disable netdata
|
||||
if [$netdata = 1]
|
||||
then
|
||||
bash <(curl -Ss https://my-netdata.io/kickstart.sh)
|
||||
ufw allow 19999/tcp
|
||||
# systemctl stop netdata
|
||||
# systemctl disable netdata
|
||||
fi
|
||||
|
||||
#-------------------#
|
||||
# MEMCACHED #
|
||||
# 127.0.0.1:11211 #
|
||||
#-------------------#
|
||||
|
||||
#apt-get install memcached -y
|
||||
#systemctl restart memcached
|
||||
# systemctl stop memcached
|
||||
# systemctl disable memcached
|
||||
|
||||
if [$memcached = 1]
|
||||
then
|
||||
apt-get install memcached -y
|
||||
systemctl restart memcached
|
||||
# systemctl stop memcached
|
||||
# systemctl disable memcached
|
||||
fi
|
||||
#-------------------#
|
||||
# REDIS #
|
||||
# 127.0.0.1:6379 #
|
||||
#-------------------#
|
||||
|
||||
#apt install redis-server -y
|
||||
#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/# requirepass foobared/requirepass '$passwd'/g' /etc/redis/redis.conf
|
||||
#systemctl restart redis
|
||||
#systemctl restart redis.service
|
||||
# systemctl stop redis
|
||||
# systemctl stop redis.service
|
||||
# systemctl disable redis
|
||||
# systemctl disable redis.service
|
||||
|
||||
if [$redis = 1]
|
||||
then
|
||||
apt install redis-server -y
|
||||
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/# requirepass foobared/requirepass '$passwd'/g' /etc/redis/redis.conf
|
||||
systemctl restart redis
|
||||
systemctl restart redis.service
|
||||
# systemctl stop redis
|
||||
# systemctl stop redis.service
|
||||
# systemctl disable redis
|
||||
# systemctl disable redis.service
|
||||
fi
|
||||
#-------------------#
|
||||
# CERTBOT #
|
||||
#-------------------#
|
||||
@@ -323,6 +325,9 @@ add-apt-repository ppa:certbot/certbot
|
||||
apt install python-certbot-nginx -y
|
||||
ufw allow 443/tcp
|
||||
#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
|
||||
|
||||
#-------------------#
|
||||
@@ -342,7 +347,6 @@ systemctl restart php7.2-fpm.service
|
||||
# MYSQL SETTINGS #
|
||||
#-------------------#
|
||||
|
||||
cd /etc/mysql
|
||||
rm /etc/mysql/my.cnf
|
||||
cat > /etc/mysql/my.cnf <<- "EOF"
|
||||
# - "/etc/mysql/my.cnf" to set global options,
|
||||
@@ -385,19 +389,21 @@ EOF
|
||||
# WP - INSTALL #
|
||||
#-------------------#
|
||||
|
||||
db_name="wp_1"
|
||||
db_user="wp_1"
|
||||
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 "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';"
|
||||
mysql -u root -p"$passwd" -e "FLUSH PRIVILEGES;"
|
||||
wget https://wordpress.org/latest.tar.gz -O /tmp/wp.tar.gz
|
||||
tar xzvf /tmp/wp.tar.gz /tmp
|
||||
mv /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
|
||||
cp -a /tmp/wordpress/. /var/www/"$domain"/html
|
||||
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
|
||||
if [$wordpress = 1]
|
||||
then
|
||||
db_name="wp_1"
|
||||
db_user="wp_1"
|
||||
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 "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';"
|
||||
mysql -u root -p"$passwd" -e "FLUSH PRIVILEGES;"
|
||||
wget https://wordpress.org/latest.tar.gz -O /tmp/wp.tar.gz
|
||||
tar xzvf /tmp/wp.tar.gz /tmp
|
||||
mv /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
|
||||
cp -a /tmp/wordpress/. /var/www/"$domain"/html
|
||||
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
|
||||
define('DB_NAME', '$db_name');
|
||||
define('DB_USER', '$db_user');
|
||||
@@ -438,12 +444,4 @@ if ( !defined('ABSPATH') )
|
||||
#define('WP_REDIS_PORT', '6379');
|
||||
require_once(ABSPATH . 'wp-settings.php');
|
||||
EOF
|
||||
|
||||
#-------------------#
|
||||
# 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"
|
||||
fi
|
||||
Reference in New Issue
Block a user