diff --git a/CMS/frontcontroller/Fpm-Pool.conf-unconfigured b/CMS/frontcontroller/Fpm-Pool.conf-unconfigured new file mode 100644 index 0000000..6230e7f --- /dev/null +++ b/CMS/frontcontroller/Fpm-Pool.conf-unconfigured @@ -0,0 +1,43 @@ +[SITEname] +user = SITEname +group = SITEname +listen = /var/run/php/phpPHPver-fpm-SITEname.sock +listen.owner = www-data +listen.group = www-data +php_admin_value[disable_functions] = exec,passthru,shell_exec,system +php_admin_value[error_log] = /var/log/php-fpm/error-SITEname.log + +; OPCACHE SETTINGS +php_admin_value[opcache.memory_consumption] = 256 +php_admin_value[opcache.enable] = 0 +php_admin_value[opcache.interned_strings_buffer] = 32 +php_admin_value[opcache.max_accelerated_files] = 50000 +php_admin_value[opcache.max_wasted_percentage] = 5 +php_admin_value[opcache.revalidate_freq] = 0 +php_admin_value[opcache.validate_timestamps] = 1 + +; PERFORMANCE LIMITS +php_admin_value[max_input_vars] = 100 +php_admin_value[upload_max_filesize] = 32M +php_admin_value[post_max_size] = 32M +php_admin_value[max_input_time] = 15 +php_admin_value[max_execution_time] = 150 + + +; SECURITY +php_admin_value[cgi.fix_pathinfo] = 1 +php_admin_value[allow_url_fopen] = On +php_admin_value[file_uploads] = On +php_admin_value[open_basedir] = /var/www/DOMAINname/html +;php_admin_value[open_basedir] = /var/www/DOMAINname/html:/tmp +php_admin_value[session.use_strict_mode] = 1 +php_admin_value[session.cookie_httponly] = 1 +;HTTPSONLY php_admin_value[session.cookie_samesite] = Strict +;HTTPSONLY php_admin_value[session.cookie_secure] = 1 + +pm = dynamic +pm.max_children = 5 +pm.start_servers = 2 +pm.min_spare_servers = 11 +pm.max_spare_servers = 3 +chdir = / diff --git a/CMS/frontcontroller/Nginx-unconfigured b/CMS/frontcontroller/Nginx-unconfigured new file mode 100644 index 0000000..fd5f0b5 --- /dev/null +++ b/CMS/frontcontroller/Nginx-unconfigured @@ -0,0 +1,30 @@ +#beginConf + + #access_log /var/log/nginx/SITEname-access.log; + error_log /var/log/nginx/SITEname-error.log; + + index index.php index.html; + root /var/www/DOMAINname/html; + 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; + + #include snippets/ngx-backendredir.conf; + + location / { + try_files $uri $uri/ $uri.html /index.php$is_args$query_string; + } + + location ~ \.php$ { + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/var/run/php/phpPHPver-fpm-SITEname.sock; + } + + location ~ /\.ht { + deny all; + } + +#endConf \ No newline at end of file diff --git a/CMS/frontcontroller/conf.sh b/CMS/frontcontroller/conf.sh new file mode 100644 index 0000000..b776752 --- /dev/null +++ b/CMS/frontcontroller/conf.sh @@ -0,0 +1,40 @@ +#Creating DB +db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1` +db_name="fc_$db_suffix" +db_user="fc_$db_suffix" +db_pass=$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' ~/DB_"$sitename" +echo "Database Username $db_user" >> ~/DB_"$sitename" +echo "Database Password $db_pass" >> ~/DB_"$sitename" + +#Setting up Database +mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" > $OUTPUT 2>&1 +mysql -u root -p"$password" -e "CREATE USER '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';" > $OUTPUT 2>&1 +mysql -u root -p"$password" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost';" > $OUTPUT 2>&1 +mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1 + + +#Creating webfolder +mkdir -p /var/www/"$domain"/public + +#Ceating content +echo "$webserv has been succsefully installed by the Wizard
Ready for FontControler installation" > /var/www/$domain/public/index.html + +#Setup PHP Pool +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/none/Fpm-Pool.conf-unconfigured -o "$phpPoolDir"/"$sitename".conf +sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/' "$phpPoolDir"/$sitename.conf +groupadd "$sitename" +useradd -g "$sitename" "$sitename" + +systemctl reload $phpFPMService + +#Setting Permsissions +chown "$sitename":"$sitename" -R /var/www/"$domain"/ + +if [ "$shortdist" = "el8" ]; then + #Setting SeLiux perms for centos + semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/$domain/(/.*)?" > $OUTPUT 2>&1 + restorecon -r /var/www/ > $OUTPUT 2>&1 +fi diff --git a/CMS/frontcontroller/nginx-conf.sh b/CMS/frontcontroller/nginx-conf.sh new file mode 100644 index 0000000..9cbedd3 --- /dev/null +++ b/CMS/frontcontroller/nginx-conf.sh @@ -0,0 +1,5 @@ +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/none/Nginx-unconfigured -o /tmp/nginx-siteconf +sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/g' -e 's/SITEname/'$sitename'/g' /tmp/nginx-siteconf +sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/nginx-siteconf' -e '/#ConfHere/c\' /etc/nginx/sites-available/"$sitename"_"$site_ext" + +systemctl reload nginx \ No newline at end of file diff --git a/ModulesMenu.list b/ModulesMenu.list index e2bbb9d..4f50d78 100644 --- a/ModulesMenu.list +++ b/ModulesMenu.list @@ -13,6 +13,7 @@ webservers+=("Apache:" "Will install Apache Webserver." OFF) nginxCMSL=("None:" "A plain webserver will be setup." OFF) nginxCMSL+=("Wordpress:" "WordPress is a content management system based on PHP." OFF) nginxCMSL+=("Nextcloud:" "Nextcloud is a suite of client-server software for creating and using file hosting services." OFF) +nginxCMSL+=("FrontController:" "Will prepair enviroment for frontcontroller." OFF) #Options nginxOptions=("Redis:" "Redis caching" OFF) nginxOptions+=("Postfix:" "Mail MTA" OFF) @@ -40,7 +41,7 @@ webservers=("Nginx" "Nginx_nonphp" "Apache" "Quit") ##Nginx #CMSList -nginxCMSL=("None" "Wordpress" "Nextcloud") +nginxCMSL=("None" "Wordpress" "Nextcloud" "FrontController") #Options nginxOptions=("Redis:" "Postfix:")