From f24076bb43fba2a9ff87b3c4c3042682198b74e1 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Thu, 30 Jul 2020 14:16:33 +0200 Subject: [PATCH] Nginx per-site log and Wordpress init script using --- CMS/Backend/nginx-siteBackend-unconfigured | 4 ++++ CMS/nextcloud/Nginx-unconfigured | 4 ++++ CMS/none/Nginx-unconfigured | 4 ++++ CMS/wordpress/MotdWordpress | 5 +++++ CMS/wordpress/Nginx-unconfigured | 4 ++++ CMS/wordpress/conf.sh | 6 ++++++ CMS/wordpress/wordpress-init.sh | 5 +++++ CoreModules/nginx/apt.list | 2 +- 8 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 CMS/wordpress/MotdWordpress create mode 100644 CMS/wordpress/wordpress-init.sh diff --git a/CMS/Backend/nginx-siteBackend-unconfigured b/CMS/Backend/nginx-siteBackend-unconfigured index 2b6d146..cdaaebb 100644 --- a/CMS/Backend/nginx-siteBackend-unconfigured +++ b/CMS/Backend/nginx-siteBackend-unconfigured @@ -1,4 +1,8 @@ #beginConf + +#access_log /var/log/nginx/Backend-access.log; +error_log /var/log/nginx/Backend-error.log; + location = /backend/netdata { return 301 /backend/netdata/; } diff --git a/CMS/nextcloud/Nginx-unconfigured b/CMS/nextcloud/Nginx-unconfigured index 04e5659..d12b972 100644 --- a/CMS/nextcloud/Nginx-unconfigured +++ b/CMS/nextcloud/Nginx-unconfigured @@ -1,4 +1,8 @@ #beginConf + +#access_log /var/log/nginx/SITEname-access.log; +error_log /var/log/nginx/SITEname-error.log; + root /var/www/DOMAINname/html; # Set max upload size client_max_body_size 1G; diff --git a/CMS/none/Nginx-unconfigured b/CMS/none/Nginx-unconfigured index cb1d177..80f5ace 100644 --- a/CMS/none/Nginx-unconfigured +++ b/CMS/none/Nginx-unconfigured @@ -1,4 +1,8 @@ #beginConf + + #access_log /var/log/nginx/SITEname-access.log; + error_log /var/log/nginx/SITEname-error.log; + index index.php index.html index.htm index.nginx-debian.html; root /var/www/DOMAINname/html; gzip on; diff --git a/CMS/wordpress/MotdWordpress b/CMS/wordpress/MotdWordpress new file mode 100644 index 0000000..5fd44c8 --- /dev/null +++ b/CMS/wordpress/MotdWordpress @@ -0,0 +1,5 @@ +#!/bin/sh +red='\e[1;31m%s\e[0m\n' +printf "\n" +printf $red "Please run wordpress-init.sh after the first wordpress login" +printf "\n" \ No newline at end of file diff --git a/CMS/wordpress/Nginx-unconfigured b/CMS/wordpress/Nginx-unconfigured index 7b56f59..dc1bc22 100644 --- a/CMS/wordpress/Nginx-unconfigured +++ b/CMS/wordpress/Nginx-unconfigured @@ -1,4 +1,8 @@ #beginConf + +#access_log /var/log/nginx/SITEname-access.log; +error_log /var/log/nginx/SITEname-error.log; + root /var/www/DOMAINname/html; index index.php index.htm index.html; diff --git a/CMS/wordpress/conf.sh b/CMS/wordpress/conf.sh index a446f14..fa678db 100644 --- a/CMS/wordpress/conf.sh +++ b/CMS/wordpress/conf.sh @@ -41,3 +41,9 @@ systemctl reload php"$phpver"-fpm #Setting Permsissions chown "$sitename":"$sitename" -R /var/www/"$domain"/html + +#Makeing wordpress Finalize script and setting login Notice +wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/wordpress/wordpress-init.sh -O ~/wordpress-init.sh +sed -i -e 's/DOMAINname/'$domain'/' -e 's/SITEname/'$sitename'/' ~/wordpress-init.sh +wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/wordpress/MotdWordpress -O /etc/update-motd.d/50-wpnotice +chmod +x /etc/update-motd.d/50-wpnotice \ No newline at end of file diff --git a/CMS/wordpress/wordpress-init.sh b/CMS/wordpress/wordpress-init.sh new file mode 100644 index 0000000..b5a8b39 --- /dev/null +++ b/CMS/wordpress/wordpress-init.sh @@ -0,0 +1,5 @@ +sudo -u SITEname wp --path=/var/www/DOMAINname/html core update +sudo -u SITEname wp --path=/var/www/DOMAINname/html plugin update --all +sudo -u SITEname wp --path=/var/www/DOMAINname/html theme update --all +sudo -u SITEname wp --path=/var/www/DOMAINname/html plugin install wp-fail2ban --activate +rm -f /etc/update-motd.d/50-wpnotice \ No newline at end of file diff --git a/CoreModules/nginx/apt.list b/CoreModules/nginx/apt.list index 9aef2c9..ce4eb81 100644 --- a/CoreModules/nginx/apt.list +++ b/CoreModules/nginx/apt.list @@ -1 +1 @@ -nginx phpPHPver-imagick php-pear phpPHPver-cli phpPHPver-fpm phpPHPver-mysql phpPHPver-cgi phpPHPver-common phpPHPver-mbstring phpPHPver-curl phpPHPver-gd phpPHPver-intl phpPHPver-soap phpPHPver-xml phpPHPver-xmlrpc phpPHPver-zip python-certbot-nginx \ No newline at end of file +nginx apache2-utils phpPHPver-imagick php-pear phpPHPver-cli phpPHPver-fpm phpPHPver-mysql phpPHPver-cgi phpPHPver-common phpPHPver-mbstring phpPHPver-curl phpPHPver-gd phpPHPver-intl phpPHPver-soap phpPHPver-xml phpPHPver-xmlrpc phpPHPver-zip python-certbot-nginx \ No newline at end of file