Skip to content

Commit aeb8511

Browse files
author
Kristan Kenney
committed
Add templates for PHP 7.4 to Multi-PHP
1 parent a06cdf0 commit aeb8511

File tree

6 files changed

+344
-0
lines changed

6 files changed

+344
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
# Adding php pool conf
3+
user="$1"
4+
domain="$2"
5+
ip="$3"
6+
home_dir="$4"
7+
docroot="$5"
8+
9+
pool_conf="[$2]
10+
11+
listen = /run/php/php7.4-fpm-$2.sock
12+
listen.owner = $1
13+
listen.group = www-data
14+
listen.mode = 0660
15+
16+
user = $1
17+
group = $1
18+
19+
pm = ondemand
20+
pm.max_children = 8
21+
pm.max_requests = 4000
22+
pm.process_idle_timeout = 10s
23+
pm.status_path = /status
24+
25+
php_admin_value[upload_tmp_dir] = /home/$1/tmp
26+
php_admin_value[session.save_path] = /home/$1/tmp
27+
php_admin_value[open_basedir] = $5:/home/$1/tmp:/bin:/usr/bin:/usr/local/bin:/var/www/html:/tmp:/usr/share:/etc/phpMyAdmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/etc/roundcubemail
28+
php_admin_value[upload_max_filesize] = 80M
29+
php_admin_value[max_execution_time] = 20
30+
php_admin_value[post_max_size] = 80M
31+
php_admin_value[memory_limit] = 256M
32+
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f info@$2
33+
php_admin_flag[mysql.allow_persistent] = off
34+
php_admin_flag[safe_mode] = off
35+
36+
env[PATH] = /usr/local/bin:/usr/bin:/bin
37+
env[TMP] = /home/$1/tmp
38+
env[TMPDIR] = /home/$1/tmp
39+
env[TEMP] = /home/$1/tmp
40+
"
41+
42+
pool_file_56="/etc/php/5.6/fpm/pool.d/$2.conf"
43+
pool_file_70="/etc/php/7.0/fpm/pool.d/$2.conf"
44+
pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
45+
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
46+
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
47+
pool_file_73="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
49+
if [ -f "$pool_file_56" ]; then
50+
rm $pool_file_56
51+
service php5.6-fpm restart
52+
fi
53+
54+
if [ -f "$pool_file_70" ]; then
55+
rm $pool_file_70
56+
service php7.0-fpm restart
57+
fi
58+
59+
if [ -f "$pool_file_71" ]; then
60+
rm $pool_file_71
61+
service php7.1-fpm restart
62+
fi
63+
64+
if [ -f "$pool_file_72" ]; then
65+
rm $pool_file_72
66+
service php7.2-fpm restart
67+
fi
68+
69+
if [ -f "$pool_file_73" ]; then
70+
rm $pool_file_73
71+
service php7.2-fpm restart
72+
fi
73+
74+
if [ ! -f "$pool_file_74" ]; then
75+
echo "$pool_conf" > $pool_file_74
76+
service php7.4-fpm restart
77+
fi
78+
79+
exit 0
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<VirtualHost %ip%:%web_ssl_port%>
2+
3+
ServerName %domain_idn%
4+
%alias_string%
5+
ServerAdmin %email%
6+
DocumentRoot %sdocroot%
7+
ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
8+
Alias /vstats/ %home%/%user%/web/%domain%/stats/
9+
Alias /error/ %home%/%user%/web/%domain%/document_errors/
10+
#SuexecUserGroup %user% %group%
11+
CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
12+
CustomLog /var/log/%web_system%/domains/%domain%.log combined
13+
ErrorLog /var/log/%web_system%/domains/%domain%.error.log
14+
<Directory %home%/%user%/web/%domain%/stats>
15+
AllowOverride All
16+
</Directory>
17+
<Directory %sdocroot%>
18+
AllowOverride All
19+
SSLRequireSSL
20+
Options +Includes -Indexes +ExecCGI
21+
</Directory>
22+
SSLEngine on
23+
SSLVerifyClient none
24+
SSLCertificateFile %ssl_crt%
25+
SSLCertificateKeyFile %ssl_key%
26+
%ssl_ca_str%SSLCertificateChainFile %ssl_ca%
27+
# <IfModule mod_ruid2.c>
28+
# RMode config
29+
# RUidGid %user% %group%
30+
# RGroups www-data
31+
# </IfModule>
32+
# <IfModule itk.c>
33+
# AssignUserID %user% %group%
34+
# </IfModule>
35+
36+
<FilesMatch \.php$>
37+
SetHandler "proxy:unix:/run/php/php7.4-fpm-%domain%.sock|fcgi://localhost/"
38+
</FilesMatch>
39+
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
40+
41+
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.ssl.conf_*
42+
43+
</VirtualHost>
44+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<VirtualHost %ip%:%web_port%>
2+
3+
ServerName %domain_idn%
4+
%alias_string%
5+
ServerAdmin %email%
6+
DocumentRoot %docroot%
7+
ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
8+
Alias /vstats/ %home%/%user%/web/%domain%/stats/
9+
Alias /error/ %home%/%user%/web/%domain%/document_errors/
10+
#SuexecUserGroup %user% %group%
11+
CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
12+
CustomLog /var/log/%web_system%/domains/%domain%.log combined
13+
ErrorLog /var/log/%web_system%/domains/%domain%.error.log
14+
15+
IncludeOptional %home%/%user%/conf/web/%domain%/apache2.forcessl.conf*
16+
17+
<Directory %home%/%user%/web/%domain%/stats>
18+
AllowOverride All
19+
</Directory>
20+
<Directory %sdocroot%>
21+
AllowOverride All
22+
Options +Includes -Indexes +ExecCGI
23+
</Directory>
24+
# <IfModule mod_ruid2.c>
25+
# RMode config
26+
# RUidGid %user% %group%
27+
# RGroups www-data
28+
# </IfModule>
29+
# <IfModule itk.c>
30+
# AssignUserID %user% %group%
31+
# </IfModule>
32+
33+
<FilesMatch \.php$>
34+
SetHandler "proxy:unix:/run/php/php7.4-fpm-%domain%.sock|fcgi://localhost/"
35+
</FilesMatch>
36+
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
37+
38+
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.conf_*
39+
40+
</VirtualHost>
41+
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
# Adding php pool conf
3+
user="$1"
4+
domain="$2"
5+
ip="$3"
6+
home_dir="$4"
7+
docroot="$5"
8+
9+
pool_conf="[$2]
10+
11+
listen = /run/php/php7.4-fpm-$2.sock
12+
listen.owner = $1
13+
listen.group = www-data
14+
listen.mode = 0660
15+
16+
user = $1
17+
group = $1
18+
19+
pm = ondemand
20+
pm.max_children = 8
21+
pm.max_requests = 4000
22+
pm.process_idle_timeout = 10s
23+
pm.status_path = /status
24+
25+
php_admin_value[upload_tmp_dir] = /home/$1/tmp
26+
php_admin_value[session.save_path] = /home/$1/tmp
27+
php_admin_value[open_basedir] = $5:/home/$1/tmp:/bin:/usr/bin:/usr/local/bin:/var/www/html:/tmp:/usr/share:/etc/phpMyAdmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/etc/roundcubemail
28+
php_admin_value[upload_max_filesize] = 80M
29+
php_admin_value[max_execution_time] = 20
30+
php_admin_value[post_max_size] = 80M
31+
php_admin_value[memory_limit] = 256M
32+
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f info@$2
33+
php_admin_flag[mysql.allow_persistent] = off
34+
php_admin_flag[safe_mode] = off
35+
36+
env[PATH] = /usr/local/bin:/usr/bin:/bin
37+
env[TMP] = /home/$1/tmp
38+
env[TMPDIR] = /home/$1/tmp
39+
env[TEMP] = /home/$1/tmp
40+
"
41+
42+
pool_file_56="/etc/php/5.6/fpm/pool.d/$2.conf"
43+
pool_file_70="/etc/php/7.0/fpm/pool.d/$2.conf"
44+
pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
45+
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
46+
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
47+
pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
49+
if [ -f "$pool_file_56" ]; then
50+
rm $pool_file_56
51+
service php5.6-fpm restart
52+
fi
53+
54+
if [ -f "$pool_file_70" ]; then
55+
rm $pool_file_70
56+
service php7.0-fpm restart
57+
fi
58+
59+
if [ -f "$pool_file_71" ]; then
60+
rm $pool_file_71
61+
service php7.1-fpm restart
62+
fi
63+
64+
if [ -f "$pool_file_72" ]; then
65+
rm $pool_file_72
66+
service php7.2-fpm restart
67+
fi
68+
69+
if [ -f "$pool_file_73" ]; then
70+
rm $pool_file_72
71+
service php7.3-fpm restart
72+
fi
73+
74+
if [ ! -f "$pool_file_74" ]; then
75+
echo "$pool_conf" > $pool_file_74
76+
service php7.4-fpm restart
77+
fi
78+
79+
exit 0
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
server {
2+
listen %ip%:%web_ssl_port% ssl http2;
3+
server_name %domain_idn% %alias_idn%;
4+
root %sdocroot%;
5+
index index.php index.html index.htm;
6+
access_log /var/log/nginx/domains/%domain%.log combined;
7+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
8+
error_log /var/log/nginx/domains/%domain%.error.log error;
9+
10+
ssl_certificate %ssl_pem%;
11+
ssl_certificate_key %ssl_key%;
12+
ssl_stapling on;
13+
ssl_stapling_verify on;
14+
15+
include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
16+
17+
location / {
18+
19+
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
20+
expires max;
21+
fastcgi_hide_header "Set-Cookie";
22+
}
23+
24+
location ~ [^/]\.php(/|$) {
25+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
26+
if (!-f $document_root$fastcgi_script_name) {
27+
return 404;
28+
}
29+
30+
fastcgi_pass unix:/run/php/php7.4-fpm-%domain%.sock;
31+
fastcgi_index index.php;
32+
include /etc/nginx/fastcgi_params;
33+
}
34+
}
35+
36+
location /error/ {
37+
alias %home%/%user%/web/%domain%/document_errors/;
38+
}
39+
40+
location ~* "/\.(htaccess|htpasswd)$" {
41+
deny all;
42+
return 404;
43+
}
44+
45+
location /vstats/ {
46+
alias %home%/%user%/web/%domain%/stats/;
47+
include %home%/%user%/web/%domain%/stats/auth.conf*;
48+
}
49+
50+
include /etc/nginx/conf.d/phpmyadmin.inc*;
51+
include /etc/nginx/conf.d/phppgadmin.inc*;
52+
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
53+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
server {
2+
listen %ip%:%web_port%;
3+
server_name %domain_idn% %alias_idn%;
4+
root %docroot%;
5+
index index.php index.html index.htm;
6+
access_log /var/log/nginx/domains/%domain%.log combined;
7+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
8+
error_log /var/log/nginx/domains/%domain%.error.log error;
9+
10+
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
11+
12+
location / {
13+
14+
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
15+
expires max;
16+
fastcgi_hide_header "Set-Cookie";
17+
}
18+
19+
location ~ [^/]\.php(/|$) {
20+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
21+
if (!-f $document_root$fastcgi_script_name) {
22+
return 404;
23+
}
24+
25+
fastcgi_pass unix:/run/php/php7.4-fpm-%domain%.sock;
26+
fastcgi_index index.php;
27+
include /etc/nginx/fastcgi_params;
28+
}
29+
}
30+
31+
location /error/ {
32+
alias %home%/%user%/web/%domain%/document_errors/;
33+
}
34+
35+
location ~* "/\.(htaccess|htpasswd)$" {
36+
deny all;
37+
return 404;
38+
}
39+
40+
location /vstats/ {
41+
alias %home%/%user%/web/%domain%/stats/;
42+
include %home%/%user%/web/%domain%/stats/auth.conf*;
43+
}
44+
45+
include /etc/nginx/conf.d/phpmyadmin.inc*;
46+
include /etc/nginx/conf.d/phppgadmin.inc*;
47+
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
48+
}

0 commit comments

Comments
 (0)