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.
- Loading branch information
Showing
15 changed files
with
203 additions
and
8 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
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> |