Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74902 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53985 invoked from network); 14 Jun 2014 12:34:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jun 2014 12:34:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=dz@heroku.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dz@heroku.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain heroku.com designates 74.125.82.44 as permitted sender) X-PHP-List-Original-Sender: dz@heroku.com X-Host-Fingerprint: 74.125.82.44 mail-wg0-f44.google.com Received: from [74.125.82.44] ([74.125.82.44:46092] helo=mail-wg0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A8/17-03909-6514C935 for ; Sat, 14 Jun 2014 08:34:30 -0400 Received: by mail-wg0-f44.google.com with SMTP id x13so3740230wgg.3 for ; Sat, 14 Jun 2014 05:34:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=sEpYDxLypvfVe4oivw9WAjHa5UNcmCyvkY2/y2uy31E=; b=Zzy830d/eGJeVCJ7L1xToJgbHiMONa2g8jxGnz4FlyTLW5jdl4XB0cuOu5dzJ6Y0Hi sUhu+TtyY/bt4FVJsSnZDuxaoBqJ7K4BS3E9+Ao486B0pBkS9G3mvDpF1U8x0O/HcyFc HCci/rmatEi30DSUmRvoBJFdZ07v7PLovi2f0BtUjec8pxgZpyFK/4RZGITtipdyQmup zuv3MQ99uvwI9g+wO2tf9c3Olwr8rVQ85Y6lovQM3cV0MQDizXpdyS1NV8o3MIxb87VF ZmoeSim/ZVHkCwlW5RpaBGJqLVXBGuhVo2NO5Na2W+iJo1suRrD/77Zg+b911yzzaCGZ IBRw== X-Gm-Message-State: ALoCoQno7S2wG+G9r9jnisU8IzY/wqCBJVd1Qq0vAO2wEtsZUU/5sNJsJRAsVzWR9aClWo6oWsgW X-Received: by 10.180.83.225 with SMTP id t1mr12454401wiy.28.1402749267594; Sat, 14 Jun 2014 05:34:27 -0700 (PDT) Received: from [172.20.10.6] (ip-109-84-2-20.web.vodafone.de. [109.84.2.20]) by mx.google.com with ESMTPSA id f3sm18883324eep.40.2014.06.14.05.34.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 14 Jun 2014 05:34:26 -0700 (PDT) Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Content-Type: text/plain; charset=windows-1252 X-Priority: 1 In-Reply-To: <7E8C4348-EFCC-491E-9B0B-1B61B87635B9@gmail.com> Date: Sat, 14 Jun 2014 14:34:29 +0200 Cc: PHP internals , Ilia Alshanetsky , Julien Pauli Content-Transfer-Encoding: quoted-printable Message-ID: <728E5397-FB75-4B3C-B4E1-855B4AA0D935@heroku.com> References: <035C7115-6871-4FC6-802E-464FD48070EF@heroku.com> <7E8C4348-EFCC-491E-9B0B-1B61B87635B9@gmail.com> To: David Muir X-Mailer: Apple Mail (2.1510) Subject: Re: [PHP-DEV] Fixing (and making easier) Apache mod_proxy_fcgi with PHP-FPM From: dz@heroku.com (David Zuelke) On 14.06.2014, at 06:57, David Muir wrote: > On 13 Jun 2014, at 5:47 am, David Zuelke wrote: >=20 >> The new approach, which can also be built as a standalone module for = older versions of Apache = (https://gist.github.com/progandy/6ed4eeea60f6277c3e39), works like = this: >>=20 >> >> SetHandler proxy:fcgi://localhost:9000 >> >>=20 >> It's very simple, and very similar to how mod_php is used in Apache, = so that'll make it very easy and convenient for users to use FPM with = Apache 2.4.10+ >=20 >=20 > This sounds great! And I see in the comments on github that it works = with unix sockets too! I just wasted several hours trying to get my = user-land rewrites working... I had to swap to using a RewriteRule = instead of ProxyPassMatch, but I could not get it working with a unix = socket. In the end I had to reconfigure FPM to listen to a tcp socket = instead. Very annoying, but I=92m very happy to see a much simpler and = cleaner solution just around the corner! Hopefully I=92ll actually be = able to start using 5.5 in production soon.=20 You can use UDS too; you just have to trick Apache into creating proxy = instances first: # we must declare a parameter in here (doesn't matter which) or = it'll not register the proxy ahead of time ProxySet disablereuse=3Doff SetHandler proxy:fcgi://php-fpm This basically creates an alias to the UDS under whatever name you give = it after "fcgi://", and you can reference that in SetHandler, rewrites = or ProxyPass(Match). Apache will pass "proxy:fcgi://php-fpm:8000" (no = idea why it picks that port) as the prefix to the backend in this case. The better solution of course would be if FPM supported the unix domain = socket syntax in SCRIPT_FILENAME et al (which will then look like = proxy:unix:/tmp/php-fpm.sock|fcgi://php-fpm, so it'll need to = "regex-strip" ^proxy:unix:[^|]+|fcgi:// instead of the static = proxy:fcgi:// prefix that it strips now. Anyone want to take a stab at fixing that? Line ~1100 in fpm_main.c :) David