Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
Open sidebar
Webslice
ISPConfig 3
Commits
ca0b77f9
Commit
ca0b77f9
authored
Sep 28, 2011
by
Falko Timme
Browse files
- nginx: Changed ispconfig and apps vhost from using PHP-FPM TCP connections to sockets.
parent
f19eb67c
Changes
11
Hide whitespace changes
Inline
Side-by-side
install/dist/lib/fedora.lib.php
View file @
ca0b77f9
...
...
@@ -942,7 +942,13 @@ class installer_dist extends installer_base {
$content
=
str_replace
(
'{fastcgi_ssl}'
,
'off'
,
$content
);
}
$content
=
str_replace
(
'{fpm_port}'
,
$conf
[
'nginx'
][
'php_fpm_start_port'
],
$content
);
$socket_dir
=
escapeshellcmd
(
$conf
[
'nginx'
][
'php_fpm_socket_dir'
]);
if
(
substr
(
$socket_dir
,
-
1
)
!=
'/'
)
$socket_dir
.
=
'/'
;
if
(
!
is_dir
(
$socket_dir
))
exec
(
'mkdir -p '
.
$socket_dir
);
$fpm_socket
=
$socket_dir
.
'ispconfig.sock'
;
//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
$content
=
str_replace
(
'{fpm_socket}'
,
$fpm_socket
,
$content
);
wf
(
$vhost_conf_dir
.
'/ispconfig.vhost'
,
$content
);
...
...
@@ -952,7 +958,8 @@ class installer_dist extends installer_base {
// Dont just copy over the php-fpm pool template but add some custom settings
$content
=
rf
(
'tpl/php_fpm_pool.conf.master'
);
$content
=
str_replace
(
'{fpm_pool}'
,
'ispconfig'
,
$content
);
$content
=
str_replace
(
'{fpm_port}'
,
$conf
[
'nginx'
][
'php_fpm_start_port'
],
$content
);
//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
$content
=
str_replace
(
'{fpm_socket}'
,
$fpm_socket
,
$content
);
$content
=
str_replace
(
'{fpm_user}'
,
'ispconfig'
,
$content
);
$content
=
str_replace
(
'{fpm_group}'
,
'ispconfig'
,
$content
);
wf
(
$conf
[
'nginx'
][
'php_fpm_pool_dir'
]
.
'/ispconfig.conf'
,
$content
);
...
...
install/dist/lib/gentoo.lib.php
View file @
ca0b77f9
...
...
@@ -642,12 +642,18 @@ class installer extends installer_base
}
else
{
$apps_vhost_ip
=
$conf
[
'web'
][
'apps_vhost_ip'
]
.
':'
;
}
$socket_dir
=
escapeshellcmd
(
$conf
[
'nginx'
][
'php_fpm_socket_dir'
]);
if
(
substr
(
$socket_dir
,
-
1
)
!=
'/'
)
$socket_dir
.
=
'/'
;
if
(
!
is_dir
(
$socket_dir
))
exec
(
'mkdir -p '
.
$socket_dir
);
$fpm_socket
=
$socket_dir
.
'apps.sock'
;
$content
=
str_replace
(
'{apps_vhost_ip}'
,
$apps_vhost_ip
,
$content
);
$content
=
str_replace
(
'{apps_vhost_port}'
,
$conf
[
'web'
][
'apps_vhost_port'
],
$content
);
$content
=
str_replace
(
'{apps_vhost_dir}'
,
$conf
[
'web'
][
'website_basedir'
]
.
'/apps'
,
$content
);
$content
=
str_replace
(
'{apps_vhost_servername}'
,
$apps_vhost_servername
,
$content
);
$content
=
str_replace
(
'{fpm_port}'
,
(
$conf
[
'nginx'
][
'php_fpm_start_port'
]
+
1
),
$content
);
//$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
$content
=
str_replace
(
'{fpm_socket}'
,
$fpm_socket
,
$content
);
wf
(
$vhost_conf_dir
.
'/apps.vhost'
,
$content
);
...
...
@@ -655,7 +661,8 @@ class installer extends installer_base
// Dont just copy over the php-fpm pool template but add some custom settings
$content
=
rf
(
'tpl/apps_php_fpm_pool.conf.master'
);
$content
=
str_replace
(
'{fpm_pool}'
,
'apps'
,
$content
);
$content
=
str_replace
(
'{fpm_port}'
,
(
$conf
[
'nginx'
][
'php_fpm_start_port'
]
+
1
),
$content
);
//$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
$content
=
str_replace
(
'{fpm_socket}'
,
$fpm_socket
,
$content
);
$content
=
str_replace
(
'{fpm_user}'
,
$apps_vhost_user
,
$content
);
$content
=
str_replace
(
'{fpm_group}'
,
$apps_vhost_group
,
$content
);
wf
(
$conf
[
'nginx'
][
'php_fpm_pool_dir'
]
.
'/apps.conf'
,
$content
);
...
...
@@ -918,7 +925,13 @@ class installer extends installer_base
$content
=
str_replace
(
'{fastcgi_ssl}'
,
'off'
,
$content
);
}
$content
=
str_replace
(
'{fpm_port}'
,
$conf
[
'nginx'
][
'php_fpm_start_port'
],
$content
);
$socket_dir
=
escapeshellcmd
(
$conf
[
'nginx'
][
'php_fpm_socket_dir'
]);
if
(
substr
(
$socket_dir
,
-
1
)
!=
'/'
)
$socket_dir
.
=
'/'
;
if
(
!
is_dir
(
$socket_dir
))
exec
(
'mkdir -p '
.
$socket_dir
);
$fpm_socket
=
$socket_dir
.
'ispconfig.sock'
;
//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
$content
=
str_replace
(
'{fpm_socket}'
,
$fpm_socket
,
$content
);
wf
(
$vhost_conf_dir
.
'/ispconfig.vhost'
,
$content
);
...
...
@@ -928,7 +941,8 @@ class installer extends installer_base
// Dont just copy over the php-fpm pool template but add some custom settings
$content
=
rf
(
'tpl/php_fpm_pool.conf.master'
);
$content
=
str_replace
(
'{fpm_pool}'
,
'ispconfig'
,
$content
);
$content
=
str_replace
(
'{fpm_port}'
,
$conf
[
'nginx'
][
'php_fpm_start_port'
],
$content
);
//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
$content
=
str_replace
(
'{fpm_socket}'
,
$fpm_socket
,
$content
);
$content
=
str_replace
(
'{fpm_user}'
,
'ispconfig'
,
$content
);
$content
=
str_replace
(
'{fpm_group}'
,
'ispconfig'
,
$content
);
wf
(
$conf
[
'nginx'
][
'php_fpm_pool_dir'
]
.
'/ispconfig.conf'
,
$content
);
...
...
install/dist/lib/opensuse.lib.php
View file @
ca0b77f9
...
...
@@ -976,7 +976,13 @@ class installer_dist extends installer_base {
$content
=
str_replace
(
'{fastcgi_ssl}'
,
'off'
,
$content
);
}
$content
=
str_replace
(
'{fpm_port}'
,
$conf
[
'nginx'
][
'php_fpm_start_port'
],
$content
);
$socket_dir
=
escapeshellcmd
(
$conf
[
'nginx'
][
'php_fpm_socket_dir'
]);
if
(
substr
(
$socket_dir
,
-
1
)
!=
'/'
)
$socket_dir
.
=
'/'
;
if
(
!
is_dir
(
$socket_dir
))
exec
(
'mkdir -p '
.
$socket_dir
);
$fpm_socket
=
$socket_dir
.
'ispconfig.sock'
;
//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
$content
=
str_replace
(
'{fpm_socket}'
,
$fpm_socket
,
$content
);
wf
(
$vhost_conf_dir
.
'/ispconfig.vhost'
,
$content
);
...
...
@@ -986,7 +992,8 @@ class installer_dist extends installer_base {
// Dont just copy over the php-fpm pool template but add some custom settings
$content
=
rf
(
'tpl/php_fpm_pool.conf.master'
);
$content
=
str_replace
(
'{fpm_pool}'
,
'ispconfig'
,
$content
);
$content
=
str_replace
(
'{fpm_port}'
,
$conf
[
'nginx'
][
'php_fpm_start_port'
],
$content
);
//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
$content
=
str_replace
(
'{fpm_socket}'
,
$fpm_socket
,
$content
);
$content
=
str_replace
(
'{fpm_user}'
,
'ispconfig'
,
$content
);
$content
=
str_replace
(
'{fpm_group}'
,
'ispconfig'
,
$content
);
wf
(
$conf
[
'nginx'
][
'php_fpm_pool_dir'
]
.
'/ispconfig.conf'
,
$content
);
...
...
install/lib/installer_base.lib.php
View file @
ca0b77f9
...
...
@@ -1472,12 +1472,18 @@ class installer_base {
}
else
{
$apps_vhost_ip
=
$conf
[
'web'
][
'apps_vhost_ip'
]
.
':'
;
}
$socket_dir
=
escapeshellcmd
(
$conf
[
'nginx'
][
'php_fpm_socket_dir'
]);
if
(
substr
(
$socket_dir
,
-
1
)
!=
'/'
)
$socket_dir
.
=
'/'
;
if
(
!
is_dir
(
$socket_dir
))
exec
(
'mkdir -p '
.
$socket_dir
);
$fpm_socket
=
$socket_dir
.
'apps.sock'
;
$content
=
str_replace
(
'{apps_vhost_ip}'
,
$apps_vhost_ip
,
$content
);
$content
=
str_replace
(
'{apps_vhost_port}'
,
$conf
[
'web'
][
'apps_vhost_port'
],
$content
);
$content
=
str_replace
(
'{apps_vhost_dir}'
,
$conf
[
'web'
][
'website_basedir'
]
.
'/apps'
,
$content
);
$content
=
str_replace
(
'{apps_vhost_servername}'
,
$apps_vhost_servername
,
$content
);
$content
=
str_replace
(
'{fpm_port}'
,
(
$conf
[
'nginx'
][
'php_fpm_start_port'
]
+
1
),
$content
);
//$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
$content
=
str_replace
(
'{fpm_socket}'
,
$fpm_socket
,
$content
);
wf
(
$vhost_conf_dir
.
'/apps.vhost'
,
$content
);
...
...
@@ -1485,7 +1491,8 @@ class installer_base {
// Dont just copy over the php-fpm pool template but add some custom settings
$content
=
rf
(
'tpl/apps_php_fpm_pool.conf.master'
);
$content
=
str_replace
(
'{fpm_pool}'
,
'apps'
,
$content
);
$content
=
str_replace
(
'{fpm_port}'
,
(
$conf
[
'nginx'
][
'php_fpm_start_port'
]
+
1
),
$content
);
//$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
$content
=
str_replace
(
'{fpm_socket}'
,
$fpm_socket
,
$content
);
$content
=
str_replace
(
'{fpm_user}'
,
$apps_vhost_user
,
$content
);
$content
=
str_replace
(
'{fpm_group}'
,
$apps_vhost_group
,
$content
);
wf
(
$conf
[
'nginx'
][
'php_fpm_pool_dir'
]
.
'/apps.conf'
,
$content
);
...
...
@@ -1808,8 +1815,14 @@ class installer_base {
$content
=
str_replace
(
'{fastcgi_ssl}'
,
'off'
,
$content
);
}
$content
=
str_replace
(
'{fpm_port}'
,
$conf
[
'nginx'
][
'php_fpm_start_port'
],
$content
);
$socket_dir
=
escapeshellcmd
(
$conf
[
'nginx'
][
'php_fpm_socket_dir'
]);
if
(
substr
(
$socket_dir
,
-
1
)
!=
'/'
)
$socket_dir
.
=
'/'
;
if
(
!
is_dir
(
$socket_dir
))
exec
(
'mkdir -p '
.
$socket_dir
);
$fpm_socket
=
$socket_dir
.
'ispconfig.sock'
;
//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
$content
=
str_replace
(
'{fpm_socket}'
,
$fpm_socket
,
$content
);
wf
(
$vhost_conf_dir
.
'/ispconfig.vhost'
,
$content
);
unset
(
$content
);
...
...
@@ -1818,7 +1831,8 @@ class installer_base {
// Dont just copy over the php-fpm pool template but add some custom settings
$content
=
rf
(
'tpl/php_fpm_pool.conf.master'
);
$content
=
str_replace
(
'{fpm_pool}'
,
'ispconfig'
,
$content
);
$content
=
str_replace
(
'{fpm_port}'
,
$conf
[
'nginx'
][
'php_fpm_start_port'
],
$content
);
//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
$content
=
str_replace
(
'{fpm_socket}'
,
$fpm_socket
,
$content
);
$content
=
str_replace
(
'{fpm_user}'
,
'ispconfig'
,
$content
);
$content
=
str_replace
(
'{fpm_group}'
,
'ispconfig'
,
$content
);
wf
(
$conf
[
'nginx'
][
'php_fpm_pool_dir'
]
.
'/ispconfig.conf'
,
$content
);
...
...
install/tpl/apps_php_fpm_pool.conf.master
View file @
ca0b77f9
[{fpm_pool}]
listen = 127.0.0.1:{fpm_port}
listen.allowed_clients = 127.0.0.1
listen = {fpm_socket}
listen.owner = {fpm_user}
listen.group = {fpm_group}
listen.mode = 0660
user = {fpm_user}
group = {fpm_group}
...
...
install/tpl/nginx_apps.vhost.master
View file @
ca0b77f9
...
...
@@ -17,7 +17,7 @@ server {
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass
127.0.0.1
:{fpm_
por
t};
fastcgi_pass
unix
:{fpm_
socke
t};
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
...
...
@@ -38,7 +38,7 @@ server {
try_files $uri =404;
root /usr/share/;
include /etc/nginx/fastcgi_params;
fastcgi_pass
127.0.0.1
:{fpm_
por
t};
fastcgi_pass
unix
:{fpm_
socke
t};
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
...
...
@@ -57,7 +57,7 @@ server {
try_files $uri =404;
root /usr/share/;
include /etc/nginx/fastcgi_params;
fastcgi_pass
127.0.0.1
:{fpm_
por
t};
fastcgi_pass
unix
:{fpm_
socke
t};
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
...
...
install/tpl/nginx_ispconfig.vhost.master
View file @
ca0b77f9
...
...
@@ -19,7 +19,7 @@ server {
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass
127.0.0.1
:{fpm_
por
t};
fastcgi_pass
unix
:{fpm_
socke
t};
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
...
...
@@ -40,7 +40,7 @@ server {
# try_files $uri =404;
# root /usr/share/;
# include /etc/nginx/fastcgi_params;
# fastcgi_pass
127.0.0.1
:{fpm_
por
t};
# fastcgi_pass
unix
:{fpm_
socke
t};
# {ssl_comment}fastcgi_param HTTPS {fastcgi_ssl};
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $request_filename;
...
...
@@ -60,7 +60,7 @@ server {
# try_files $uri =404;
# root /usr/share/;
# include /etc/nginx/fastcgi_params;
# fastcgi_pass
127.0.0.1
:{fpm_
por
t};
# fastcgi_pass
unix
:{fpm_
socke
t};
# {ssl_comment}fastcgi_param HTTPS {fastcgi_ssl};
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $request_filename;
...
...
install/tpl/php_fpm_pool.conf.master
View file @
ca0b77f9
[{fpm_pool}]
listen = 127.0.0.1:{fpm_port}
listen.allowed_clients = 127.0.0.1
listen = {fpm_socket}
listen.owner = {fpm_user}
listen.group = {fpm_group}
listen.mode = 0660
user = {fpm_user}
group = {fpm_group}
...
...
server/conf/nginx_apps.vhost.master
View file @
ca0b77f9
...
...
@@ -17,7 +17,7 @@ server {
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass
127.0.0.1
:{fpm_
por
t};
fastcgi_pass
unix
:{fpm_
socke
t};
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
...
...
@@ -38,7 +38,7 @@ server {
try_files $uri =404;
root /usr/share/;
include /etc/nginx/fastcgi_params;
fastcgi_pass
127.0.0.1
:{fpm_
por
t};
fastcgi_pass
unix
:{fpm_
socke
t};
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
...
...
@@ -57,7 +57,7 @@ server {
try_files $uri =404;
root /usr/share/;
include /etc/nginx/fastcgi_params;
fastcgi_pass
127.0.0.1
:{fpm_
por
t};
fastcgi_pass
unix
:{fpm_
socke
t};
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
...
...
server/plugins-available/apps_vhost_plugin.inc.php
View file @
ca0b77f9
...
...
@@ -117,12 +117,18 @@ class apps_vhost_plugin {
}
else
{
$apps_vhost_ip
=
$web_config
[
'apps_vhost_ip'
]
.
':'
;
}
$socket_dir
=
escapeshellcmd
(
$web_config
[
'php_fpm_socket_dir'
]);
if
(
substr
(
$socket_dir
,
-
1
)
!=
'/'
)
$socket_dir
.
=
'/'
;
if
(
!
is_dir
(
$socket_dir
))
exec
(
'mkdir -p '
.
$socket_dir
);
$fpm_socket
=
$socket_dir
.
'apps.sock'
;
$content
=
str_replace
(
'{apps_vhost_ip}'
,
$apps_vhost_ip
,
$content
);
$content
=
str_replace
(
'{apps_vhost_port}'
,
$web_config
[
'apps_vhost_port'
],
$content
);
$content
=
str_replace
(
'{apps_vhost_dir}'
,
$web_config
[
'website_basedir'
]
.
'/apps'
,
$content
);
$content
=
str_replace
(
'{apps_vhost_servername}'
,
$apps_vhost_servername
,
$content
);
$content
=
str_replace
(
'{fpm_port}'
,
$web_config
[
'php_fpm_start_port'
]
+
1
,
$content
);
//$content = str_replace('{fpm_port}', $web_config['php_fpm_start_port']+1, $content);
$content
=
str_replace
(
'{fpm_socket}'
,
$fpm_socket
,
$content
);
}
file_put_contents
(
"
$vhost_conf_dir
/apps.vhost"
,
$content
);
...
...
server/plugins-available/nginx_plugin.inc.php
View file @
ca0b77f9
...
...
@@ -660,7 +660,7 @@ class nginx_plugin {
$tpl
->
setVar
(
'use_socket'
,
$use_socket
);
$fpm_socket
=
$socket_dir
.
$pool_name
.
'.sock'
;
$tpl
->
setVar
(
'fpm_socket'
,
$fpm_socket
);
$vhost_data
[
'fpm_port'
]
=
$web_config
[
'php_fpm_start_port'
]
+
$data
[
'new'
][
'domain_id'
]
+
1
;
$vhost_data
[
'fpm_port'
]
=
$web_config
[
'php_fpm_start_port'
]
+
$data
[
'new'
][
'domain_id'
]
-
1
;
// Custom nginx directives
$final_nginx_directives
=
array
();
...
...
@@ -1129,7 +1129,7 @@ class nginx_plugin {
$tpl
->
setVar
(
'fpm_socket'
,
$fpm_socket
);
$tpl
->
setVar
(
'fpm_pool'
,
$pool_name
);
$tpl
->
setVar
(
'fpm_port'
,
$web_config
[
'php_fpm_start_port'
]
+
$data
[
'new'
][
'domain_id'
]
+
1
);
$tpl
->
setVar
(
'fpm_port'
,
$web_config
[
'php_fpm_start_port'
]
+
$data
[
'new'
][
'domain_id'
]
-
1
);
$tpl
->
setVar
(
'fpm_user'
,
$data
[
'new'
][
'system_user'
]);
$tpl
->
setVar
(
'fpm_group'
,
$data
[
'new'
][
'system_group'
]);
$tpl
->
setVar
(
'pm_max_children'
,
$data
[
'new'
][
'pm_max_children'
]);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment