'RevProxySimple.sh' updaten

This commit is contained in:
ictmaatwerk
2018-09-18 09:43:17 +00:00
parent 445f64daf2
commit 7a1d390041

View File

@@ -10,8 +10,9 @@
server_ip=$(hostname -I|cut -f1 -d ' ') server_ip=$(hostname -I|cut -f1 -d ' ')
# Block direct apache acces # Block direct apache acces
#ufw deny 8080/tcp #ufw deny 8080/tcp
# Create domain specific folder # Setup domain folders
mkdir -p /var/www/"$domain"/html rm /var/www/html
mkdir -p /var/www/"$domain"/public_html
##-----------## ##-----------##
# NGINX # # NGINX #
@@ -23,8 +24,8 @@ cat <<EOF > /etc/nginx/sites-available/"$domain"
server { server {
listen 80; listen 80;
root /var/www/$domain/html; root /var/www/$domain/public_html;
index index.php index.html index.htm; index index.html index.htm index.php;
server_name $domain www.$domain; server_name $domain www.$domain;
@@ -60,7 +61,7 @@ cat <<EOF > /etc/apache2/sites-available/"$domain".conf
ServerAdmin $email ServerAdmin $email
ServerName $domain ServerName $domain
ServerAlias www.$domain ServerAlias www.$domain
DocumentRoot /var/www/$domain/html DocumentRoot /var/www/$domain/public_html
ErrorLog \${APACHE_LOG_DIR}/error.log ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined CustomLog \${APACHE_LOG_DIR}/access.log combined
</VirtualHost> </VirtualHost>
@@ -79,9 +80,9 @@ apt install -y libapache2-mod-php php-mysql php-cgi php-common php-pear php-mbst
##----------------## ##----------------##
apt install -y phpmyadmin apt install -y phpmyadmin
ln -s /usr/share/phpmyadmin /var/www/"$domain"/html/phpmyadmin ln -s /usr/share/phpmyadmin /var/www/"$domain"/public_html/phpmyadmin
# Redirect phpmyadmin -> database # Redirect phpmyadmin -> database
mv /var/www/"$domain"/html/phpmyadmin /var/www/"$domain"/html/database mv /var/www/"$domain"/public_html/phpmyadmin /var/www/"$domain"/public_html/database
a2disconf phpmyadmin.conf a2disconf phpmyadmin.conf
systemctl restart apache2 systemctl restart apache2
@@ -184,9 +185,9 @@ if [ $wordpress = 1 ]
wget https://wordpress.org/latest.tar.gz -O /tmp/wp.tar.gz wget https://wordpress.org/latest.tar.gz -O /tmp/wp.tar.gz
tar xzvf /tmp/wp.tar.gz -C /tmp tar xzvf /tmp/wp.tar.gz -C /tmp
mv /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php mv /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
cp -a /tmp/wordpress/. /var/www/"$domain"/html cp -a /tmp/wordpress/. /var/www/"$domain"/public_html
WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -) WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -)
cat <<EOF > /var/www/"$domain"/html/wp-config.php cat <<EOF > /var/www/"$domain"/public_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');
@@ -233,13 +234,13 @@ fi
# OPCACHE GUI # # OPCACHE GUI #
##-----------------## ##-----------------##
wget https://raw.githubusercontent.com/amnuts/opcache-gui/master/index.php -O /var/www/"$domain"/html/opcache.php wget https://raw.githubusercontent.com/amnuts/opcache-gui/master/index.php -O /var/www/"$domain"/public_html/opcache.php
##--------------## ##--------------##
# info.php # # info.php #
##--------------## ##--------------##
cat > /var/www/"$domain"/html/info.php <<- "EOF" cat > /var/www/"$domain"/public_html/info.php <<- "EOF"
<?php <?php
phpinfo(); phpinfo();
EOF EOF
@@ -248,5 +249,5 @@ EOF
# Html Folder Perms # # Html Folder Perms #
##-----------------------## ##-----------------------##
chown -R www-data:www-data /var/www/"$domain"/html chown -R www-data:www-data /var/www/"$domain"/public_html