PHP support for sockets (vs TCP) improved

This commit is contained in:
Marc Aymerich 2017-07-05 17:52:37 +00:00
parent a1f73d883a
commit 6fadf0c631
2 changed files with 7 additions and 6 deletions

View File

@ -205,7 +205,7 @@ class PHPController(WebAppServiceMixin, ServiceController):
context['fpm_listen'] = webapp.type_instance.FPM_LISTEN % context context['fpm_listen'] = webapp.type_instance.FPM_LISTEN % context
fpm_config = Template(textwrap.dedent("""\ fpm_config = Template(textwrap.dedent("""\
;; {{ banner }} ;; {{ banner }}
[{{ user }}] [{{ user }}-{{app_id}}]
user = {{ user }} user = {{ user }}
group = {{ group }} group = {{ group }}

View File

@ -227,15 +227,16 @@ class Apache2Controller(ServiceController):
target = 'fcgi://%(socket)s%(app_path)s/$1' target = 'fcgi://%(socket)s%(app_path)s/$1'
else: else:
# UNIX socket # UNIX socket
target = 'unix:%(socket)s|fcgi://127.0.0.1%(app_path)s/' target = 'unix:%(socket)s|fcgi://127.0.0.1/'
if context['location']:
# FIXME unix sockets do not support $1
target = 'unix:%(socket)s|fcgi://127.0.0.1%(app_path)s/$1'
context.update({ context.update({
'app_path': os.path.normpath(app_path), 'app_path': os.path.normpath(app_path),
'socket': socket, 'socket': socket,
}) })
directives = "ProxyPassMatch ^%(location)s/(.*\.php(/.*)?)$ {target}\n".format(target=target) % context directives = textwrap.dedent("""
<FilesMatch "\.php$">
SetHandler "proxy:unix:{socket}|fcgi://127.0.0.1"
</FilesMatch>
""").format(socket=socket)
directives += self.get_location_filesystem_map(context) directives += self.get_location_filesystem_map(context)
return [ return [
(context['location'], directives), (context['location'], directives),