From e85a369f4b41d02d68ad2ba143a01895222a0d2f Mon Sep 17 00:00:00 2001 From: ictmaatwerk Date: Wed, 12 Sep 2018 13:00:33 +0000 Subject: [PATCH] 'Apache-RevProxNGINX-Installer.sh' updaten --- Apache-RevProxNGINX-Installer.sh | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Apache-RevProxNGINX-Installer.sh b/Apache-RevProxNGINX-Installer.sh index 3cec641..6c7c5f4 100644 --- a/Apache-RevProxNGINX-Installer.sh +++ b/Apache-RevProxNGINX-Installer.sh @@ -11,13 +11,12 @@ server_ip=$(hostname -I|cut -f1 -d ' ') # Block direct apache acces ufw deny 8080/tcp -ufw allow from "$server_ip" proto tcp to any port 8080 #-------------------# # APACHE + PHP-FPM # #-------------------# -apt install apache2 php-fpm -y +apt install -y apache2 php-fpm wget https://mirrors.edge.kernel.org/ubuntu/pool/multiverse/liba/libapache-mod-fastcgi/libapache2-mod-fastcgi_2.4.7~0910052141-1.2_amd64.deb dpkg -i libapache2-mod-fastcgi_2.4.7~0910052141-1.2_amd64.deb mv /etc/apache2/ports.conf /etc/apache2/ports.conf.default @@ -33,7 +32,7 @@ netstat -tlpn # MYSQL # #-------------------# -apt install mysql-server-5.7 -y +apt install -y mysql-server-5.7 mysql_secure_installation mysql -u root -p"$passwd" -e "SELECT user,authentication_string,plugin,host FROM mysql.user;" mysql -u root -p"$passwd" -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '"$passwd"';" @@ -86,7 +85,7 @@ systemctl reload apache2 # VHOST NGINX # #-------------------# -apt install nginx -y +apt install -y nginx rm /etc/nginx/sites-enabled/default #mkdir -v /usr/share/nginx/$domain2 #echo "" | tee /usr/share/nginx/$domain2/info.php @@ -127,7 +126,7 @@ server { } location ~ \.php\$ { - proxy_pass http://$server_ip:8080; + proxy_pass http://127.0.0.1:8080; proxy_set_header Host \$host; proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; @@ -153,7 +152,7 @@ systemctl reload nginx # MOD_RPAF # #-------------------# -apt install unzip build-essential apache2-dev -y +apt install -y unzip build-essential apache2-dev wget https://github.com/gnif/mod_rpaf/archive/stable.zip unzip stable.zip cd mod_rpaf-stable @@ -166,7 +165,7 @@ cat < /etc/apache2/mods-available/rpaf.conf RPAF_Enable On RPAF_Header X-Real-Ip - RPAF_ProxyIPs $server_ip + RPAF_ProxyIPs 127.0.0.1 RPAF_SetHostName On RPAF_SetHTTPS On RPAF_SetPort On @@ -180,16 +179,16 @@ systemctl reload apache2 # CERTBOT # #-------------------# -add-apt-repository ppa:certbot/certbot -y +add-apt-repository -y ppa:certbot/certbot apt update -apt install python-certbot-nginx -y +apt install -y python-certbot-nginx #certbot --nginx -d $domain -d www.$domain #-------------------# # PHPMYADMIN # #-------------------# -apt-get install phpmyadmin -y +apt install -y phpmyadmin ln -s /usr/share/phpmyadmin /var/www/"$domain"/public_html systemctl restart php7.2-fpm # Redirect phpmyadmin -> database @@ -201,7 +200,9 @@ systemctl restart apache2 # POSTFIX # #-------------------# -apt install mailutils -y +debconf-set-selections <<< "postfix postfix/mailname string $domain" +debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" +apt install -y mailutils sed -i 's/#inet_interfaces = all/inet_interfaces = loopback-only/g' /etc/postfix/main.cf sed -i 's/mydestination/#mydestination/g' /etc/postfix/main.cf sed -i 's/relayhost =/mydestination = '$domain', localhost.'$domain', '$domain'/g' /etc/postfix/main.cf @@ -219,7 +220,7 @@ newaliases if [ $netdata = 1 ] then - apt install netdata -y + apt install -y netdata ufw allow 19999/tcp # systemctl stop netdata # systemctl disable netdata @@ -232,7 +233,7 @@ fi if [ $memcached = 1 ] then - apt-get install memcached -y + apt install -y memcached systemctl restart memcached # systemctl stop memcached # systemctl disable memcached @@ -245,7 +246,7 @@ fi if [ $redis = 1 ] then - apt install redis-server -y + 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 sed -i 's/# requirepass foobared/requirepass '$passwd'/g' /etc/redis/redis.conf