Update 'RevProxySimple.sh'
This commit is contained in:
@@ -36,6 +36,8 @@ mysql -u root -p"$password" -e "FLUSH PRIVILEGES;"
|
|||||||
mysql -u root -p"$password" -e "SELECT user,authentication_string,plugin,host FROM mysql.user;"
|
mysql -u root -p"$password" -e "SELECT user,authentication_string,plugin,host FROM mysql.user;"
|
||||||
rm /etc/nginx/sites-enabled/default
|
rm /etc/nginx/sites-enabled/default
|
||||||
cat <<EOF > /etc/nginx/sites-available/"$domain"
|
cat <<EOF > /etc/nginx/sites-available/"$domain"
|
||||||
|
#netdata placeholder
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name $domain www.$domain;
|
server_name $domain www.$domain;
|
||||||
@@ -69,7 +71,7 @@ ln -s /etc/nginx/sites-available/"$domain" /etc/nginx/sites-enabled/"$domain"
|
|||||||
|
|
||||||
apt install -y apache2
|
apt install -y apache2
|
||||||
mv /etc/apache2/ports.conf /etc/apache2/ports.conf.default
|
mv /etc/apache2/ports.conf /etc/apache2/ports.conf.default
|
||||||
echo "Listen 127.0.0.1:8080" | tee /etc/apache2/ports.conf
|
echo "Listen 8080" | tee /etc/apache2/ports.conf
|
||||||
cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/"$domain.conf"
|
cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/"$domain.conf"
|
||||||
cat <<EOF > /etc/apache2/sites-available/"$domain.conf"
|
cat <<EOF > /etc/apache2/sites-available/"$domain.conf"
|
||||||
<VirtualHost *:8080>
|
<VirtualHost *:8080>
|
||||||
@@ -134,11 +136,11 @@ newaliases
|
|||||||
# Netdata #
|
# Netdata #
|
||||||
##-------------##
|
##-------------##
|
||||||
|
|
||||||
if [ $netdata = 1 ]
|
if [ $netdata = 1 ]; then
|
||||||
then
|
|
||||||
apt install -y netdata
|
apt install -y netdata
|
||||||
sed -i 's/SEND_EMAIL="YES"/SEND_EMAIL="NO"/g' /etc/netdata/health_alarm_notify.conf
|
sed -i 's/SEND_EMAIL="YES"/SEND_EMAIL="NO"/g' /etc/netdata/health_alarm_notify.conf
|
||||||
ufw allow 19999/tcp
|
ufw allow 19999/tcp
|
||||||
|
sed -i 's+#netdata placeholder+upstream netdata {\n server 127.0.0.1:19999;\n keepalive 64;\n}+g'
|
||||||
sed -i 's+#netdata here+location = /netdata {\n return 301 /netdata/;\n }\n\n location ~ /netdata/(?<ndpath>.*) {\n proxy_redirect off;\n proxy_set_header Host \$host;\n proxy_set_header X-Forwarded-Host \$host;\n proxy_set_header X-Forwarded-Server \$host;\n proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;\n proxy_http_version 1.1;\n proxy_pass_request_headers on;\n proxy_set_header Connection "keep-alive";\n proxy_store off;\n proxy_pass http://netdata/\$ndpath\$is_args\$args;\n }+g' /etc/nginx/sites-available/"$domain"
|
sed -i 's+#netdata here+location = /netdata {\n return 301 /netdata/;\n }\n\n location ~ /netdata/(?<ndpath>.*) {\n proxy_redirect off;\n proxy_set_header Host \$host;\n proxy_set_header X-Forwarded-Host \$host;\n proxy_set_header X-Forwarded-Server \$host;\n proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;\n proxy_http_version 1.1;\n proxy_pass_request_headers on;\n proxy_set_header Connection "keep-alive";\n proxy_store off;\n proxy_pass http://netdata/\$ndpath\$is_args\$args;\n }+g' /etc/nginx/sites-available/"$domain"
|
||||||
# systemctl stop netdata
|
# systemctl stop netdata
|
||||||
# systemctl disable netdata
|
# systemctl disable netdata
|
||||||
@@ -148,8 +150,7 @@ fi
|
|||||||
# Memcached #
|
# Memcached #
|
||||||
##---------------##
|
##---------------##
|
||||||
|
|
||||||
if [ $memcached = 1 ]
|
if [ $memcached = 1 ]; then
|
||||||
then
|
|
||||||
apt install -y memcached
|
apt install -y memcached
|
||||||
# systemctl stop memcached
|
# systemctl stop memcached
|
||||||
# systemctl disable memcached
|
# systemctl disable memcached
|
||||||
@@ -159,8 +160,7 @@ fi
|
|||||||
# Redis #
|
# Redis #
|
||||||
##-----------##
|
##-----------##
|
||||||
|
|
||||||
if [ $redis = 1 ]
|
if [ $redis = 1 ]; then
|
||||||
then
|
|
||||||
apt install -y redis-server
|
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
|
||||||
@@ -183,10 +183,10 @@ sed -i 's#include /etc/letsencrypt/options-ssl-nginx.conf;#ssl_ciphers EECDH+CHA
|
|||||||
# Wordpress #
|
# Wordpress #
|
||||||
##---------------##
|
##---------------##
|
||||||
|
|
||||||
if [ $wordpress = 1 ]
|
if [ $wordpress = 1 ]; then
|
||||||
then
|
db_suffix=$(ls -l /var/www | grep -c ^d)
|
||||||
db_name="wp_1"
|
db_name="wp_$db_suffix"
|
||||||
db_user="wp_1"
|
db_user="wp_$db_suffix"
|
||||||
db_pass=$(date +%s|sha256sum|base64|head -c 32)
|
db_pass=$(date +%s|sha256sum|base64|head -c 32)
|
||||||
mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
|
mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
|
||||||
mysql -u root -p"$password" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';"
|
mysql -u root -p"$password" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';"
|
||||||
|
|||||||
Reference in New Issue
Block a user