Welcome! Log In Create A New Profile

Advanced

[PHP] php-fpm and apache

Posted by @lbutlr 
@lbutlr
[PHP] php-fpm and apache
December 26, 2017 11:40PM
I'm reading a bunch of of writreups on using php in apache 2.4 and everything is coming down very much against using mod_php as I've been doing for… well, ages. But the configuration at setup for using php-fpm seems unnecessarily convoluted.

As I understand it, you setup a proxy and then send php files via that proxy, which means adjusting every vhost on the server.

Is there a way to setup php-amp so that it basically works the way mod-php did, in that all .php files are processed simply used on their extension?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
@lbutlr
[PHP] Re: php-fpm and apache
December 27, 2017 05:20PM
Hi, I hate to repost, but I did not receive this message back from the list, so I am unsure it got posted. So it's not a complete repeat, I've added a little information.

I have php working within Apache 2.4 by adding the Proxy method to the virtual host, but am holding off on doing this for all the virtual hosts if I can avoid it.

DocumentRoot /usr/local/www/roundcube/
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/www/roundcube/$1

I suppose I could write a quick script to automate this.

On 26 Dec 2017, at 15:31, @lbutlr <[email protected]> wrote:
> I'm reading a bunch of writre-ups on using php in apache 2.4 and everything is coming down very much against using mod_php as I've been doing for… well, ages. But the configuration at setup for using php-fpm seems unnecessarily convoluted.
>
> As I understand it, you setup a proxy and then send php files via that proxy, which means adjusting every vhost on the server.
>
> Is there a way to setup php-amp so that it basically works the way mod-php did, in that all .php files are processed simply based on their extension?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Curtis Maurand
Re: [PHP] Re: php-fpm and apache
December 28, 2017 12:20PM
I set up a host using ispconfig which does it this way. It solves a whole bunch of security and file permission problems that I'd been having with cms engines and such because it runs everything under the site owner rather than www-data. It really works pretty well. If you were running tomcat or mono, they're also done as a proxy.

On December 27, 2017 11:15:22 AM EST, "@lbutlr" <[email protected]> wrote:
>Hi, I hate to repost, but I did not receive this message back from the
>list, so I am unsure it got posted. So it's not a complete repeat, I've
>added a little information.
>
>I have php working within Apache 2.4 by adding the Proxy method to the
>virtual host, but am holding off on doing this for all the virtual
>hosts if I can avoid it.
>
> DocumentRoot /usr/local/www/roundcube/
>ProxyPassMatch ^/(.*\.php)$
>fcgi://127.0.0.1:9000/usr/local/www/roundcube/$1
>
>I suppose I could write a quick script to automate this.
>
>On 26 Dec 2017, at 15:31, @lbutlr <[email protected]> wrote:
>> I'm reading a bunch of writre-ups on using php in apache 2.4 and
>everything is coming down very much against using mod_php as I've been
>doing for… well, ages. But the configuration at setup for using php-fpm
>seems unnecessarily convoluted.
>>
>> As I understand it, you setup a proxy and then send php files via
>that proxy, which means adjusting every vhost on the server.
>>
>> Is there a way to setup php-amp so that it basically works the way
>mod-php did, in that all .php files are processed simply based on their
>extension?
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Vince LaMonica
Re: [PHP] Re: php-fpm and apache
December 29, 2017 06:50PM
@lbutlr wrote:
> Hi, I hate to repost, but I did not receive this message back from the list, so I am unsure it got posted. So it's not a complete repeat, I've added a little information.
>
> I have php working within Apache 2.4 by adding the Proxy method to the virtual host, but am holding off on doing this for all the virtual hosts if I can avoid it.
>
> DocumentRoot /usr/local/www/roundcube/
> ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/www/roundcube/$1

I'd recommend creating a socket instead [lower overhead]. I do this for
a few dozen virtual domains and it's been running smoothly for a few years.

Example:

Protocols h2 http/1.1
DocumentRoot /home/web_example1.com/websites/example1.com/www
SuexecUserGroup web_example1 web_example1
<FilesMatch \.php$>
SetHandler
"proxy:unix:/var/run/php/php7-fpm-example1.sock|fcgi://example1"
</FilesMatch>
<Proxy "fcgi://example1/">
Require ip 1.2.3.4
</Proxy>

The "1.2.3.4" IP should be your public IP that the proxy can use
[otherwise anyone can use your host as a proxy].

Then edit your /etc/php/7.0/fpm/pool.d/www.example1.com.conf with your
path to the UNIX socket along with the rest of the php-fpm settings for
your virtual domain.

HTH,

/vjl/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, only registered users may post in this forum.

Click here to login