Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #133 from niiknow/master
Browse files Browse the repository at this point in the history
Fix nginx build
  • Loading branch information
noogen authored Dec 2, 2020
2 parents bb3427e + 3c0daaf commit e977824
Show file tree
Hide file tree
Showing 15 changed files with 204 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM niiknow/docker-hostingbase:1.5.3
LABEL maintainer="noogen <[email protected]>"
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 \
Expand Down Expand Up @@ -62,7 +62,7 @@ RUN cd /tmp \
&& apt-get build-dep nginx -y \
&& cd ${NGINX_BUILD_DIR}/nginx-${NGINX_VERSION}; dpkg-buildpackage -uc -us -b \
&& cd ${NGINX_BUILD_DIR} \
&& dpkg -i nginx_${NGINX_VERSION}-1~xenial_amd64.deb \
&& dpkg -i nginx_${NGINX_VERSION}-2~xenial_amd64.deb \
&& apt-get install -yq php7.4-mbstring php7.4-cgi php7.4-cli php7.4-dev php7.4-geoip php7.4-common php7.4-xmlrpc php7.4-sybase php7.4-curl \
php7.4-enchant php7.4-imap php7.4-xsl php7.4-mysql php7.4-mysqli php7.4-mysqlnd php7.4-pspell php7.4-gd php7.4-zip \
php7.4-tidy php7.4-opcache php7.4-json php7.4-bz2 php7.4-pgsql php7.4-readline php7.4-imagick php7.3-phar \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rootfs/sysprepz/apache2-templates/php72fpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"
Expand Down
2 changes: 1 addition & 1 deletion rootfs/sysprepz/apache2-templates/php73fpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"
Expand Down
2 changes: 1 addition & 1 deletion rootfs/sysprepz/apache2-templates/php73fpm.stpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#<VirtualHost %ip%:%web_ssl_port%>
#
# ServerName %domain_idn%
# # php72fpm
# # php73fpm
# DocumentRoot %sdocroot%
# <Location />
# Deny from all
Expand Down
2 changes: 1 addition & 1 deletion rootfs/sysprepz/apache2-templates/php73fpm.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#<VirtualHost %ip%:%web_port%>
#
# ServerName %domain_idn%
# # php72fpm
# # php73fpm
# DocumentRoot %sdocroot%
# <Location />
# Deny from all
Expand Down
2 changes: 1 addition & 1 deletion rootfs/sysprepz/apache2-templates/php74fpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"
Expand Down
2 changes: 1 addition & 1 deletion rootfs/sysprepz/apache2-templates/php74fpm.stpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#<VirtualHost %ip%:%web_ssl_port%>
#
# ServerName %domain_idn%
# # php72fpm
# # php74fpm
# DocumentRoot %sdocroot%
# <Location />
# Deny from all
Expand Down
2 changes: 1 addition & 1 deletion rootfs/sysprepz/apache2-templates/php74fpm.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#<VirtualHost %ip%:%web_port%>
#
# ServerName %domain_idn%
# # php72fpm
# # php74fpm
# DocumentRoot %sdocroot%
# <Location />
# Deny from all
Expand Down
79 changes: 79 additions & 0 deletions rootfs/sysprepz/apache2-templates/php80fpm.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions rootfs/sysprepz/apache2-templates/php80fpm.stpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#<VirtualHost %ip%:%web_ssl_port%>
#
# ServerName %domain_idn%
# # php80fpm
# DocumentRoot %sdocroot%
# <Location />
# Deny from all
# Allow from none
# </Location>
#</VirtualHost>
11 changes: 11 additions & 0 deletions rootfs/sysprepz/apache2-templates/php80fpm.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#<VirtualHost %ip%:%web_port%>
#
# ServerName %domain_idn%
# # php80fpm
# DocumentRoot %sdocroot%
# <Location />
# Deny from all
# Allow from none
# </Location>
#</VirtualHost>
22 changes: 22 additions & 0 deletions rootfs/sysprepz/apache2-templates/phpfcgid80.sh
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions rootfs/sysprepz/apache2-templates/phpfcgid80.stpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

<VirtualHost %ip%:%web_ssl_port%>

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
<Directory %sdocroot%>
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
<Files *.php>
SetHandler fcgid-script
</Files>
FCGIWrapper %home%/%user%/web/%domain%/cgi-bin/fcgi8.0 .php
</Directory>
<Directory %home%/%user%/web/%domain%/stats>
AllowOverride All
</Directory>

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*

</VirtualHost>
32 changes: 32 additions & 0 deletions rootfs/sysprepz/apache2-templates/phpfcgid80.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

<VirtualHost %ip%:%web_port%>

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
<Directory %docroot%>
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
<Files *.php>
SetHandler fcgid-script
</Files>
FCGIWrapper %home%/%user%/web/%domain%/cgi-bin/fcgi8.0 .php
</Directory>
<Directory %home%/%user%/web/%domain%/stats>
AllowOverride All
</Directory>

IncludeOptional %home%/%user%/conf/web/%web_system%.%domain%.conf*

</VirtualHost>

0 comments on commit e977824

Please sign in to comment.