From 6fadf0c631b5acfbb7dad181918d363764400432 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Wed, 5 Jul 2017 17:52:37 +0000 Subject: [PATCH] PHP support for sockets (vs TCP) improved --- orchestra/contrib/webapps/backends/php.py | 2 +- orchestra/contrib/websites/backends/apache.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/orchestra/contrib/webapps/backends/php.py b/orchestra/contrib/webapps/backends/php.py index 88395db9..ef549325 100644 --- a/orchestra/contrib/webapps/backends/php.py +++ b/orchestra/contrib/webapps/backends/php.py @@ -205,7 +205,7 @@ class PHPController(WebAppServiceMixin, ServiceController): context['fpm_listen'] = webapp.type_instance.FPM_LISTEN % context fpm_config = Template(textwrap.dedent("""\ ;; {{ banner }} - [{{ user }}] + [{{ user }}-{{app_id}}] user = {{ user }} group = {{ group }} diff --git a/orchestra/contrib/websites/backends/apache.py b/orchestra/contrib/websites/backends/apache.py index 9d42f7f9..c6a11092 100644 --- a/orchestra/contrib/websites/backends/apache.py +++ b/orchestra/contrib/websites/backends/apache.py @@ -227,15 +227,16 @@ class Apache2Controller(ServiceController): target = 'fcgi://%(socket)s%(app_path)s/$1' else: # UNIX socket - target = 'unix:%(socket)s|fcgi://127.0.0.1%(app_path)s/' - if context['location']: - # FIXME unix sockets do not support $1 - target = 'unix:%(socket)s|fcgi://127.0.0.1%(app_path)s/$1' + target = 'unix:%(socket)s|fcgi://127.0.0.1/' context.update({ 'app_path': os.path.normpath(app_path), 'socket': socket, }) - directives = "ProxyPassMatch ^%(location)s/(.*\.php(/.*)?)$ {target}\n".format(target=target) % context + directives = textwrap.dedent(""" + + SetHandler "proxy:unix:{socket}|fcgi://127.0.0.1" + + """).format(socket=socket) directives += self.get_location_filesystem_map(context) return [ (context['location'], directives),