From 3c0daaf8630f93030a4c88d1e480403d1acd5018 Mon Sep 17 00:00:00 2001 From: noogen Date: Tue, 1 Dec 2020 18:29:48 -0600 Subject: [PATCH] fix nginx build and prep php8.0 --- Dockerfile | 2 +- README.md | 1 + rootfs/sysprepz/apache2-templates/php72fpm.sh | 2 +- rootfs/sysprepz/apache2-templates/php73fpm.sh | 2 +- .../sysprepz/apache2-templates/php73fpm.stpl | 2 +- .../sysprepz/apache2-templates/php73fpm.tpl | 2 +- rootfs/sysprepz/apache2-templates/php74fpm.sh | 2 +- .../sysprepz/apache2-templates/php74fpm.stpl | 2 +- .../sysprepz/apache2-templates/php74fpm.tpl | 2 +- rootfs/sysprepz/apache2-templates/php80fpm.sh | 79 +++++++++++++++++++ .../sysprepz/apache2-templates/php80fpm.stpl | 11 +++ .../sysprepz/apache2-templates/php80fpm.tpl | 11 +++ .../sysprepz/apache2-templates/phpfcgid80.sh | 22 ++++++ .../apache2-templates/phpfcgid80.stpl | 39 +++++++++ .../sysprepz/apache2-templates/phpfcgid80.tpl | 32 ++++++++ 15 files changed, 203 insertions(+), 8 deletions(-) create mode 100755 rootfs/sysprepz/apache2-templates/php80fpm.sh create mode 100644 rootfs/sysprepz/apache2-templates/php80fpm.stpl create mode 100644 rootfs/sysprepz/apache2-templates/php80fpm.tpl create mode 100755 rootfs/sysprepz/apache2-templates/phpfcgid80.sh create mode 100644 rootfs/sysprepz/apache2-templates/phpfcgid80.stpl create mode 100644 rootfs/sysprepz/apache2-templates/phpfcgid80.tpl diff --git a/Dockerfile b/Dockerfile index c217ecd..c03c9f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM niiknow/docker-hostingbase:1.5.3 LABEL maintainer="noogen " ENV DEBIAN_FRONTEND=noninteractive \ VESTA=/usr/local/vesta \ - GOLANG_VERSION=1.14.3 \ + GOLANG_VERSION=1.15.5 \ NGINX_BUILD_DIR=/usr/src/nginx \ NGINX_DEVEL_KIT_VERSION=0.3.0 NGINX_SET_MISC_MODULE_VERSION=0.32 \ NGINX_VERSION=1.18.0 \ diff --git a/README.md b/README.md index 4e4dd69..1528545 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ server { ## Release Notes +1.9.4 - fix build and prep for php8.0 1.9.1 - build update for nginx 1.18.0, GoLang 1.14.3, nodejs 12, and phpv8js for php7.4 1.9.0 - remove php7.1 and add php7.4, update to GoLang 1.13.5 and dotnet 3.1 diff --git a/rootfs/sysprepz/apache2-templates/php72fpm.sh b/rootfs/sysprepz/apache2-templates/php72fpm.sh index 61f94b9..33be2df 100755 --- a/rootfs/sysprepz/apache2-templates/php72fpm.sh +++ b/rootfs/sysprepz/apache2-templates/php72fpm.sh @@ -42,7 +42,7 @@ rm -f /home/$user/web/$domain/cgi-bin/php*-fpm.conf # restart any *running* php fpm found with ps -uaxw # otherwise, simply use: # find /etc/init.d/ -name 'php*-fpm*' -type f -exec basename {} \; | xargs -I{} service {} restart || true -phpfpms="7.2:7.3:7.4" +phpfpms="7.2:7.3:7.4:8.0" iphpfpm=(${phpfpms//:/ }) for i in "${!iphpfpm[@]}" diff --git a/rootfs/sysprepz/apache2-templates/php73fpm.sh b/rootfs/sysprepz/apache2-templates/php73fpm.sh index 258fcc7..9cb5625 100755 --- a/rootfs/sysprepz/apache2-templates/php73fpm.sh +++ b/rootfs/sysprepz/apache2-templates/php73fpm.sh @@ -42,7 +42,7 @@ rm -f /home/$user/web/$domain/cgi-bin/php*-fpm.conf # restart any *running* php fpm found with ps -uaxw # otherwise, simply use: # find /etc/init.d/ -name 'php*-fpm*' -type f -exec basename {} \; | xargs -I{} service {} restart || true -phpfpms="7.2:7.3:7.4" +phpfpms="7.2:7.3:7.4:8.0" iphpfpm=(${phpfpms//:/ }) for i in "${!iphpfpm[@]}" diff --git a/rootfs/sysprepz/apache2-templates/php73fpm.stpl b/rootfs/sysprepz/apache2-templates/php73fpm.stpl index 48488a7..e629890 100644 --- a/rootfs/sysprepz/apache2-templates/php73fpm.stpl +++ b/rootfs/sysprepz/apache2-templates/php73fpm.stpl @@ -2,7 +2,7 @@ # # # ServerName %domain_idn% -# # php72fpm +# # php73fpm # DocumentRoot %sdocroot% # # Deny from all diff --git a/rootfs/sysprepz/apache2-templates/php73fpm.tpl b/rootfs/sysprepz/apache2-templates/php73fpm.tpl index 60e3b9d..1834d02 100644 --- a/rootfs/sysprepz/apache2-templates/php73fpm.tpl +++ b/rootfs/sysprepz/apache2-templates/php73fpm.tpl @@ -2,7 +2,7 @@ # # # ServerName %domain_idn% -# # php72fpm +# # php73fpm # DocumentRoot %sdocroot% # # Deny from all diff --git a/rootfs/sysprepz/apache2-templates/php74fpm.sh b/rootfs/sysprepz/apache2-templates/php74fpm.sh index 60eb565..443529e 100755 --- a/rootfs/sysprepz/apache2-templates/php74fpm.sh +++ b/rootfs/sysprepz/apache2-templates/php74fpm.sh @@ -42,7 +42,7 @@ rm -f /home/$user/web/$domain/cgi-bin/php*-fpm.conf # restart any *running* php fpm found with ps -uaxw # otherwise, simply use: # find /etc/init.d/ -name 'php*-fpm*' -type f -exec basename {} \; | xargs -I{} service {} restart || true -phpfpms="7.2:7.3:7.4" +phpfpms="7.2:7.3:7.4:8.0" iphpfpm=(${phpfpms//:/ }) for i in "${!iphpfpm[@]}" diff --git a/rootfs/sysprepz/apache2-templates/php74fpm.stpl b/rootfs/sysprepz/apache2-templates/php74fpm.stpl index 48488a7..1386f4d 100644 --- a/rootfs/sysprepz/apache2-templates/php74fpm.stpl +++ b/rootfs/sysprepz/apache2-templates/php74fpm.stpl @@ -2,7 +2,7 @@ # # # ServerName %domain_idn% -# # php72fpm +# # php74fpm # DocumentRoot %sdocroot% # # Deny from all diff --git a/rootfs/sysprepz/apache2-templates/php74fpm.tpl b/rootfs/sysprepz/apache2-templates/php74fpm.tpl index 60e3b9d..4df3a3e 100644 --- a/rootfs/sysprepz/apache2-templates/php74fpm.tpl +++ b/rootfs/sysprepz/apache2-templates/php74fpm.tpl @@ -2,7 +2,7 @@ # # # ServerName %domain_idn% -# # php72fpm +# # php74fpm # DocumentRoot %sdocroot% # # Deny from all diff --git a/rootfs/sysprepz/apache2-templates/php80fpm.sh b/rootfs/sysprepz/apache2-templates/php80fpm.sh new file mode 100755 index 0000000..be237c6 --- /dev/null +++ b/rootfs/sysprepz/apache2-templates/php80fpm.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# adding conf +user="$1" +domain="$2" +ip="$3" +home_dir="$4" +docroot="$5" +php_version="8.0" + +fpm_conf=" +[$domain] +listen = /var/run/vesta-php-fpm-$domain.sock +listen.allowed_clients = 127.0.0.1 + +user = $user +group = $user + +listen.owner = $user +listen.group = www-data + +pm = ondemand +pm.max_children = 4 +pm.max_requests = 4000 +pm.process_idle_timeout = 10s +pm.status_path = /status + +php_admin_value[upload_tmp_dir] = /home/$user/web/$domain/tmp +php_admin_value[session.save_path] = /home/$user/web/$domain/tmp +php_admin_value[open_basedir] = $docroot:/home/$user/web/$domain/tmp + +env[HOSTNAME] = $HOSTNAME +env[PATH] = /usr/local/bin:/usr/bin:/bin +env[TMP] = /home/$user/tmp +env[TMPDIR] = /home/$user/tmp +env[TEMP] = /home/$user/tmp +" +fpm_conf_file="/home/$user/web/$domain/cgi-bin/php-fpm.conf" + +# remove old conf +rm -f /home/$user/web/$domain/cgi-bin/php*-fpm.conf + +# restart any *running* php fpm found with ps -uaxw +# otherwise, simply use: +# find /etc/init.d/ -name 'php*-fpm*' -type f -exec basename {} \; | xargs -I{} service {} restart || true +phpfpms="7.2:7.3:7.4:8.0" + +iphpfpm=(${phpfpms//:/ }) +for i in "${!iphpfpm[@]}" +do + if ps auxw | grep php/${iphpfpm[i]}/fpm | grep -v grep > /dev/null + then + service php${iphpfpm[i]}-fpm restart || true + fi +done + +# make sure to delete old sock file before restart +rm -f /var/run/vesta-php-fpm-$domain.sock || true + +echo "$fpm_conf" > $fpm_conf_file +chown $user:$user $fpm_conf_file +chmod -f 751 $fpm_conf_file +mkdir -p /home/$user/web/$domain/tmp/cache +rm -rf /home/$user/web/$domain/tmp/* +chown $user:$user /home/$user/web/$domain/tmp +mkdir -p /home/$user/web/$domain/tmp/cache +chown -R www-data:www-data /home/$user/web/$domain/tmp/cache + +# delete old and link new conf +rm -f /etc/php/*/fpm/pool.d/$domain.conf +ln -sf $fpm_conf_file /etc/php/$php_version/fpm/pool.d/$domain.conf + + +# start if it's not running +service php$php_version-fpm start || true +service php$php_version-fpm restart || true + +service nginx restart || true + +exit 0 diff --git a/rootfs/sysprepz/apache2-templates/php80fpm.stpl b/rootfs/sysprepz/apache2-templates/php80fpm.stpl new file mode 100644 index 0000000..a3e15c1 --- /dev/null +++ b/rootfs/sysprepz/apache2-templates/php80fpm.stpl @@ -0,0 +1,11 @@ + +# +# +# ServerName %domain_idn% +# # php80fpm +# DocumentRoot %sdocroot% +# +# Deny from all +# Allow from none +# +# diff --git a/rootfs/sysprepz/apache2-templates/php80fpm.tpl b/rootfs/sysprepz/apache2-templates/php80fpm.tpl new file mode 100644 index 0000000..c4e7cf6 --- /dev/null +++ b/rootfs/sysprepz/apache2-templates/php80fpm.tpl @@ -0,0 +1,11 @@ + +# +# +# ServerName %domain_idn% +# # php80fpm +# DocumentRoot %sdocroot% +# +# Deny from all +# Allow from none +# +# diff --git a/rootfs/sysprepz/apache2-templates/phpfcgid80.sh b/rootfs/sysprepz/apache2-templates/phpfcgid80.sh new file mode 100755 index 0000000..53b9c12 --- /dev/null +++ b/rootfs/sysprepz/apache2-templates/phpfcgid80.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Adding php wrapper +user="$1" +domain="$2" +ip="$3" +home_dir="$4" +docroot="$5" + +wrapper_script="#!/bin/sh +PHPRC=/usr/local/lib +export PHPRC +export PHP_FCGI_MAX_REQUESTS=1000 +export PHP_FCGI_CHILDREN=4 +exec /usr/bin/php-cgi8.0 +" +wrapper_file="/home/$user/web/$domain/cgi-bin/fcgi8.0" + +echo "$wrapper_script" > $wrapper_file +chown $user:$user $wrapper_file +chmod -f 751 $wrapper_file + +exit 0 \ No newline at end of file diff --git a/rootfs/sysprepz/apache2-templates/phpfcgid80.stpl b/rootfs/sysprepz/apache2-templates/phpfcgid80.stpl new file mode 100644 index 0000000..ece814b --- /dev/null +++ b/rootfs/sysprepz/apache2-templates/phpfcgid80.stpl @@ -0,0 +1,39 @@ + + + + ServerName %domain_idn% + %alias_string% + ServerAdmin %email% + DocumentRoot %sdocroot% + ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/ + Alias /vstats/ %home%/%user%/web/%domain%/stats/ + Alias /error/ %home%/%user%/web/%domain%/document_errors/ + SuexecUserGroup %user% %group% + CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes + CustomLog /var/log/%web_system%/domains/%domain%.log combined + ErrorLog /var/log/%web_system%/domains/%domain%.error.log + + SSLRequireSSL + AllowOverride All + Options +Includes -Indexes +ExecCGI + php_admin_value open_basedir %docroot%:%home%/%user%/web/%domain%/tmp + php_admin_value upload_tmp_dir %home%/%user%/web/%domain%/tmp + php_admin_value session.save_path %home%/%user%/web/%domain%/tmp + + SetHandler fcgid-script + + FCGIWrapper %home%/%user%/web/%domain%/cgi-bin/fcgi8.0 .php + + + AllowOverride All + + + SSLEngine on + SSLVerifyClient none + SSLCertificateFile %ssl_crt% + SSLCertificateKeyFile %ssl_key% + %ssl_ca_str%SSLCertificateChainFile %ssl_ca% + + IncludeOptional %home%/%user%/conf/web/s%web_system%.%domain%.conf* + + \ No newline at end of file diff --git a/rootfs/sysprepz/apache2-templates/phpfcgid80.tpl b/rootfs/sysprepz/apache2-templates/phpfcgid80.tpl new file mode 100644 index 0000000..26034bc --- /dev/null +++ b/rootfs/sysprepz/apache2-templates/phpfcgid80.tpl @@ -0,0 +1,32 @@ + + + + ServerName %domain_idn% + %alias_string% + ServerAdmin %email% + DocumentRoot %docroot% + ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/ + Alias /vstats/ %home%/%user%/web/%domain%/stats/ + Alias /error/ %home%/%user%/web/%domain%/document_errors/ + SuexecUserGroup %user% %group% + CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes + CustomLog /var/log/%web_system%/domains/%domain%.log combined + ErrorLog /var/log/%web_system%/domains/%domain%.error.log + + AllowOverride All + Options +Includes -Indexes +ExecCGI + php_admin_value open_basedir %docroot%:%home%/%user%/web/%domain%/tmp + php_admin_value upload_tmp_dir %home%/%user%/web/%domain%/tmp + php_admin_value session.save_path %home%/%user%/web/%domain%/tmp + + SetHandler fcgid-script + + FCGIWrapper %home%/%user%/web/%domain%/cgi-bin/fcgi8.0 .php + + + AllowOverride All + + + IncludeOptional %home%/%user%/conf/web/%web_system%.%domain%.conf* + + \ No newline at end of file