This repository has been archived by the owner on Jan 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #133 from niiknow/master
Fix nginx build
- Loading branch information
Showing
15 changed files
with
204 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 \ | ||
|
@@ -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 \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |