Update 'RevProxySimple.sh'

This commit is contained in:
tbergervoet
2018-10-05 14:56:10 +02:00
parent fb7d6d4553
commit 15e0c99264

View File

@@ -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;"
rm /etc/nginx/sites-enabled/default
cat <<EOF > /etc/nginx/sites-available/"$domain"
#netdata placeholder
server {
listen 80;
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
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"
cat <<EOF > /etc/apache2/sites-available/"$domain.conf"
<VirtualHost *:8080>
@@ -134,11 +136,11 @@ newaliases
# Netdata #
##-------------##
if [ $netdata = 1 ]
then
if [ $netdata = 1 ]; then
apt install -y netdata
sed -i 's/SEND_EMAIL="YES"/SEND_EMAIL="NO"/g' /etc/netdata/health_alarm_notify.conf
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"
# systemctl stop netdata
# systemctl disable netdata
@@ -148,8 +150,7 @@ fi
# Memcached #
##---------------##
if [ $memcached = 1 ]
then
if [ $memcached = 1 ]; then
apt install -y memcached
# systemctl stop memcached
# systemctl disable memcached
@@ -159,8 +160,7 @@ fi
# Redis #
##-----------##
if [ $redis = 1 ]
then
if [ $redis = 1 ]; then
apt install -y redis-server
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
@@ -183,10 +183,10 @@ sed -i 's#include /etc/letsencrypt/options-ssl-nginx.conf;#ssl_ciphers EECDH+CHA
# Wordpress #
##---------------##
if [ $wordpress = 1 ]
then
db_name="wp_1"
db_user="wp_1"
if [ $wordpress = 1 ]; then
db_suffix=$(ls -l /var/www | grep -c ^d)
db_name="wp_$db_suffix"
db_user="wp_$db_suffix"
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 "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';"