On Mon, Jan 6, 2014 at 1:17 PM, Daniel Ruggeri <drugg...@primary.net> wrote:
>
> One more vote for the UDS patch would be appreciated if anyone could
> spare a moment to have a look. Happy New Year all, BTW.

I tried the UDS patch in httpd trunk with mod_proxy_fcgi and PHP-FPM,
and ProxyPass is working nicely now. I used the following config:

<LocationMatch ^(.*\.php)$>
    ProxyPass unix:/tmp/php-fpm.sock|fcgi://PHP1${DOCROOT}
</LocationMatch>

One thing worth pointing out is that some unique dummy hostname, such
as that "PHP1" in the above example, is required after the real
scheme. It might be tempting to pick "localhost", but that would
result in problems when using multiple sockets.

Next I tried using UDS with mod_rewrite, but I couldn't get that to
work. Using this config:

RewriteRule /php-info
unix:/tmp/php-fpm.sock|fcgi://${DOCROOT}/ppp/info.php [P,L]

with this URL:

http://localhost:8000/php-info

I got a 404. Turning on tracing for mod_rewrite:

[Mon Jan 06 13:56:25.653655 2014] [rewrite:trace2] [pid 15211:tid
140236536502016] mod_rewrite.c(472): [client ::1:49459] ::1 - -
[localhost/sid#21a5a58][rid#7f8b44002970/initial] rewrite '/php-info'
-> 
'unix:/tmp/php-fpm.sock|fcgi:///data/local/build/apache/inst/htdocs/ppp/info.php'
[Mon Jan 06 13:56:25.653672 2014] [rewrite:trace2] [pid 15211:tid
140236536502016] mod_rewrite.c(472): [client ::1:49459] ::1 - -
[localhost/sid#21a5a58][rid#7f8b44002970/initial] forcing
proxy-throughput with
http://localhost:8000/unix:/tmp/php-fpm.sock|fcgi:///data/local/build/apache/inst/htdocs/ppp/info.php
[Mon Jan 06 13:56:25.653702 2014] [rewrite:trace1] [pid 15211:tid
140236536502016] mod_rewrite.c(472): [client ::1:49459] ::1 - -
[localhost/sid#21a5a58][rid#7f8b44002970/initial] go-ahead with proxy
request 
proxy:http://localhost:8000/unix:/tmp/php-fpm.sock|fcgi:///data/local/build/apache/inst/htdocs/ppp/info.php
[OK]

So mod_rewrite is not recognizing the "unix:" prefix as being valid. I
temporarily commented out the call of fully_qualify_uri(r) at
mod_rewrite.c:4130, and now r->filename is set correctly:

[Mon Jan 06 14:30:47.758212 2014] [rewrite:trace2] [pid 20870:tid
140038133200640] mod_rewrite.c(472): [client ::1:50308] ::1 - -
[localhost/sid#2535a58][rid#7f5d14002970/initial] rewrite '/php-info'
-> 
'unix:/tmp/php-fpm.sock|fcgi:///data/local/build/apache/inst/htdocs/ppp/info.php'
[Mon Jan 06 14:30:47.758226 2014] [rewrite:trace2] [pid 20870:tid
140038133200640] mod_rewrite.c(472): [client ::1:50308] ::1 - -
[localhost/sid#2535a58][rid#7f5d14002970/initial] forcing
proxy-throughput with
unix:/tmp/php-fpm.sock|fcgi:///data/local/build/apache/inst/htdocs/ppp/info.php
[Mon Jan 06 14:30:47.758253 2014] [rewrite:trace1] [pid 20870:tid
140038133200640] mod_rewrite.c(472): [client ::1:50308] ::1 - -
[localhost/sid#2535a58][rid#7f5d14002970/initial] go-ahead with proxy
request 
proxy:unix:/tmp/php-fpm.sock|fcgi:///data/local/build/apache/inst/htdocs/ppp/info.php
[OK]
[Mon Jan 06 14:30:47.758379 2014] [proxy:trace2] [pid 20870:tid
140038133200640] proxy_util.c(1932): [client ::1:50308] *: found
reverse proxy worker for
unix:/tmp/php-fpm.sock|fcgi:///data/local/build/apache/inst/htdocs/ppp/info.php
[Mon Jan 06 14:30:47.758392 2014] [proxy:debug] [pid 20870:tid
140038133200640] mod_proxy.c(1138): [client ::1:50308] AH01143:
Running scheme unix handler (attempt 0)
[Mon Jan 06 14:30:47.758403 2014] [proxy_fcgi:debug] [pid 20870:tid
140038133200640] mod_proxy_fcgi.c(770): [client ::1:50308] AH01076:
url: 
unix:/tmp/php-fpm.sock|fcgi:///data/local/build/apache/inst/htdocs/ppp/info.php
proxyname: (null) proxyport: 0
[Mon Jan 06 14:30:47.758411 2014] [proxy_fcgi:debug] [pid 20870:tid
140038133200640] mod_proxy_fcgi.c(773): [client ::1:50308] AH01077:
declining URL 
unix:/tmp/php-fpm.sock|fcgi:///data/local/build/apache/inst/htdocs/ppp/info.php
[Mon Jan 06 14:30:47.758418 2014] [proxy:warn] [pid 20870:tid
140038133200640] [client ::1:50308] AH01144: No protocol handler was
valid for the URL /php-info. If you are using a DSO version of
mod_proxy, make sure the proxy submodules are included in the
configuration using LoadModule.

but this results in a 500. It looks like mod_proxy is not ready for a
UDS URI in r->filename when it was set by some other module earlier in
the request.

-- 
Blaise

Reply via email to