From 641c2d2d00dbf374c588bf43218609264f01ac74 Mon Sep 17 00:00:00 2001 From: "b.waal" Date: Sat, 7 Sep 2019 00:47:42 +0200 Subject: [PATCH] Update 'installer.sh' --- installer.sh | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 119 insertions(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index a213e10..287f980 100644 --- a/installer.sh +++ b/installer.sh @@ -58,7 +58,124 @@ chown -R www-data:www-data /var/www/"$domain"/html ##-----------## apt install -y nginx wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/config/nginx/nginx-default.conf -O /etc/nginx/nginx.conf -wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/omega/config/nginx/domainconfig.cf -O /etc/nginx/sites-available/$domain + + + + + +cat < /etc/nginx/sites-available/"$domain" +#fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=MYAPP:100m max_size=10g inactive=1440m; + +server { + listen 80; + server_name www.$domain; + return 301 http://$domain\$request_uri; +} + +server { + listen 80; + listen [::]:80; + root /var/www/$domain/html; + index index.php index.html index.htm index.nginx-debian.html; + server_name $domain; + #return 301 \$scheme:/\$domain\$request_uri; Redirect to non-www + #return 301 https://domein.nl$request_uri; Redirect to other domain + + #add_header X-Cache "\$upstream_cache_status"; + + #netdata here + + gzip on; + gzip_proxied any; + gzip_types text/plain text/css text/xml text/javascript application/javascript application/x-javascript image/svg image/svg+xml application/xml image/x-icon; + gzip_comp_level 2; + gzip_disable "msie6"; + gzip_buffers 16 8k; + +# location /rspamd { +# proxy_pass http://127.0.0.1:11334/; +# proxy_set_header Host \$host; +# proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; +#} + + location / { + #try_files \$uri \$uri/ =404; + try_files \$uri \$uri/ /index.php\$is_args\$args; + #try_files \$uri \$uri/ \$uri.html \$uri.php\$is_args\$query_string; + } + + location = /favicon.ico { log_not_found off; access_log off; } + location = /robots.txt { log_not_found off; access_log off; allow all; } + location ~* \.(css|gif|ico|jpeg|jpg|js|png|svg|webp|eot|otf|woff|woff2|ttf|ogg)\$ { + expires max; + log_not_found off; + add_header Cache-Control "public, no-transform"; + } + + location ~ \.php\$ { + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/var/run/php/php${phpver}-fpm.sock; + #fastcgi_cache MYAPP; + #fastcgi_cache_valid 200 302 301 1m; + #fastcgi_cache_valid 404 1m; + #fastcgi_cache_bypass \$no_cache; + #fastcgi_no_cache \$no_cache; + #fastcgi_cache_revalidate on; + #fastcgi_cache_background_update on; + #fastcgi_cache_lock on; + #fastcgi_cache_use_stale updating; + #fastcgi_buffer_size 128k; + #fastcgi_buffers 256 16k; + #fastcgi_busy_buffers_size 256k; + #fastcgi_temp_file_write_size 256k; + } + + location ~ /\.ht { + deny all; + } + + location /phpmyadmin { + index index.php; + } + + #Cache everything by default + set \$no_cache 0; + + #Don't cache POST requests + if (\$request_method = POST) { + set \$no_cache 1; + } + + #Don't cache if the URL contains a query string + if (\$query_string != "") { + set \$no_cache 1; + } + + #Don't cache the following URLs + if (\$request_uri ~* "/(administrator/|login.php)") { + set \$no_cache 1; + } + + #Don't cache if there is a cookie called PHPSESSID + if (\$http_cookie = "PHPSESSID") { + set \$no_cache 1; + } + } +EOF + + + + + + + + + + + + + +#wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/omega/config/nginx/domainconfig.cf -O /etc/nginx/sites-available/$domain sed -i -e 's/DOMAINNAME/'$domain'/' -e 's/phpPHPVER/'php${phpver}'/' /etc/nginx/sites-available/$domain ##-------------------------------## @@ -113,6 +230,7 @@ useradd -u 5000 -g vmail -s /usr/sbin/nologin -d /var/mail/vmail -m vmail ##-------------## # Certbot # ##-------------## +mkdir -p /etc/letsencrypt/live/$domain/ #add-apt-repository ppa:certbot/certbot -y #apt install -y python-certbot-nginx #certbot --nginx -n -d "$domain" -m "$email" --hsts --redirect --no-eff-email --agree-tos