[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [users@httpd] Configuration help - addhandler <> mod_proxy_fcgi


Am 08.03.2018 um 08:54 schrieb Hajo Locke:

Am 11.09.2017 um 14:58 schrieb Eric Covener:
On Mon, Sep 11, 2017 at 4:28 AM, Hajo Locke <Hajo.Locke@xxxxxx> wrote:
Hello List,

currently i use classic mod_fastcgi (fastcgiexternalserver) with php-fpm,
which is quite reliable.
A disadvantage of this setup is, that not every response-header set by
.htaccess will really send to client.
Something like this is the current setup:

<IfModule mod_fastcgi.c>
    AddHandler myphp-cgi .php
    Action myphp-cgi /cgi-fpm/php71-fpm

The big advantage is, that my users are able to use addhandler by .htaccess
to choose any provided php-version.

Now i try to switch from mod_fastcgi to new recommend way of mod_proxy_fcgi

The basic variants with SetHandler are working easily:
<FilesMatch \.php$|\.php70$|\.phpx$>
    SetHandler "proxy:unix:/dev/shm/php70fpm.sock|fcgi://localhost/"

Now i want to use AddHandler again, so .htaccess files of my users will
automatically work former way and choose proper php-version.
Unfortunately i was not able to combine AddHandler, Action and the proxy in
a working way:

Addhandler php-mycgi .php
Action php-mycgi "proxy:unix:/dev/shm/php71fpm.sock|fcgi://localhost/"

When enabling this in global conf every request to php files results in a
400 response:
[Mon Sep 11 10:10:09.375597 2017] [core:error] [pid 23826] [client
x.x.x.x:53050] AH00126: Invalid URI in request GET /phpinfo.php HTTP/1.1

Please give me a hint to a working configuration. All my attempts were not

Action could be tricky here. Are you using php-fpm? Have you
considered allowing users to point at different sockets for diffrenent
fpm pools?
I have to continue on this problem. Unfortunately i did not found any useful solution. Seems to be my last problem on switching from mod_fastcgi to proxy_fcgi
May be i describe my problem again, finding a better wording.

Current setup is apache->mod_fastcgi->php-fpm
php-fpm is installed in multiple version and provides a socket for each version for each user.
every user can choose a fitting php-version for his script simple by .htaccess:
Addhandler php71 .php
Addhander php56 .php

Every usable addhandler has a fitting action directive in global conf, so mod_fastcgi knows which php-socket to connect.

I would like to offer same service after switching to proxy_fcgi. Unfortunately i did not found any useful setup. it seems that
action directive of mod_actions not understands a proxy notation. following is not working:

Addhandler php-mycgi .php
Action php-mycgi "proxy:unix:/dev/shm/php71fpm.sock|fcgi://localhost/"

This results in 400 error:
[Mon Sep 11 10:10:09.375597 2017] [core:error] [pid 23826] [client x.x.x.x:53050] AH00126: Invalid URI in request GET /phpinfo.php HTTP/1.1

Basically this would work by .htaccess
Addhandler "proxy:unix:///dev/shm/php70fpm.sock|fcgi://localhost/" .php
But there are two big disadvantages:
- Our Users have thousands of .htaccess files with traditional AddHandler notation. We cant require that all users rewrite there .htaccess Files.
- this addhandler is not working if a proxy for this file-extension is already established in VHost. But this is a requirement, because not all Users use .htaccess files.

So a user is not able to combine a fileextension to any php-fpm version by his own.

So my objective is to make former .htaccess entries "Addhandler php71 .php" to work with a proxy_fcgi setup without the need to change hundreds of thousands .htaccess files.
I was not able to find a good solution for this.

Please help and give me some tips to get this work.

old problem, still without a good solution. this is closest i currently found:
we define a proxy:

<Proxy "unix:/dev/shm/user1-php72fpm.sock|fcgi://user1-php72fpm">
        ProxySet ..............
after that we define a variable:
Define php72-cgi "proxy:unix:/dev/shm/user1-php72fpm.sock|fcgi://user1-php72fpm/"
now we are able to use this for addhandler, also in .htaccess
AddHandler ${php72-cgi} .php

this is closest to former "Addhandler php72-cgi .php" which i found. do you think this is suitable solution?
Iam not sure. looks not really good...

To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx