'RevProxySimple.sh' updaten

This commit is contained in:
ictmaatwerk
2018-09-17 12:42:00 +00:00
parent b2ab26d1c0
commit 445f64daf2

View File

@@ -7,7 +7,7 @@
##----------------##
# Set server IP variable for apache access
#server_ip=$(hostname -I|cut -f1 -d ' ')
server_ip=$(hostname -I|cut -f1 -d ' ')
# Block direct apache acces
#ufw deny 8080/tcp
# Create domain specific folder
@@ -23,7 +23,7 @@ cat <<EOF > /etc/nginx/sites-available/"$domain"
server {
listen 80;
root /var/www/$domain;
root /var/www/$domain/html;
index index.php index.html index.htm;
server_name $domain www.$domain;
@@ -36,7 +36,7 @@ server {
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$remote_addr;
proxy_set_header Host \$host;
proxy_pass http://127.0.0.1:8080;
proxy_pass http://$server_ip:8080;
}
location ~ /\.ht {
@@ -44,7 +44,7 @@ server {
}
}
EOF
#ln -s /etc/nginx/sites-available/"$domain" /etc/nginx/sites-enabled/"$domain"
ln -s /etc/nginx/sites-available/"$domain" /etc/nginx/sites-enabled/"$domain"
nginx_ensite "$domain"
##------------##
@@ -53,14 +53,14 @@ nginx_ensite "$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 $server_ip: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>
ServerAdmin $email
ServerName $domain
ServerAlias www.$domain
DocumentRoot /var/www/$domain/public_html
DocumentRoot /var/www/$domain/html
ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
@@ -229,12 +229,6 @@ require_once(ABSPATH . 'wp-settings.php');
EOF
fi
##----------------------##
# WWW Folder Perms #
##----------------------##
chown -R www-data:www-data /var/www/"$domain"/html
##-----------------##
# OPCACHE GUI #
##-----------------##
@@ -248,4 +242,11 @@ wget https://raw.githubusercontent.com/amnuts/opcache-gui/master/index.php -O /v
cat > /var/www/"$domain"/html/info.php <<- "EOF"
<?php
phpinfo();
EOF
EOF
##-----------------------##
# Html Folder Perms #
##-----------------------##
chown -R www-data:www-data /var/www/"$domain"/html