[CentOS] Is decoupling Apache + PHP into separate nodes possible?
knura9 at gmail.com
Thu Jul 26 22:37:22 UTC 2018
On Thu, Jul 26, 2018 at 2:03 PM, Rich Bowen <rbowen at redhat.com> wrote:
Thanks very much for your reply.
> On 07/26/2018 04:48 PM, Arun Khan wrote:
>> With PHP-FPM it is conceivable to have Apache talk to PHP-FPM running
>> on a separate node (see diagram https://goo.gl/xTfbjg).
>> But I have not done it myself and I am not sure if it is feasible.
> With my Apache httpd documentation hat on ...
> Yes, and this is the recommended way to do it (ie, php-fpm vs mod_php). FPM
> lets you run the Event MPM with confidence, and that's what you *should* be
> running. Whereas with mod_php, we still recommend prefork, due to threading
> issues, and prefork sucks.
That's what I have read and lately I've been deploying PHP-FPM (v/s
the default mod_PHP) but Apache+PHP-FPM have been on the same node.
>> If it is feasible then what's the best practice to distribute the
>> *.html *.css and *.php files between the Apache + the PHP-FPM nodes
>> and how to achieve load balance between Apache and PHP-FPM nodes. I
>> have searched but not found any reference setups.
>> Would appreciate suggestions / references from anyone who has done a 3
>> Tier Apache + PHP + MySQL deployment in production.
> We (the httpd docs team) recommend *.php on the php node, and everything
> else on the httpd node.
I was thinking in similar lines but was not sure if it would work.
Your recommendation helps clarify the setup.
> Configure as shown here: https://wiki.apache.org/httpd/PHP-FPM
Yes. I got started with Apache + PHP-FPM from this link and it has
been a bookmark for a few months :)
> This is how I run all my websites, although I only do one httpd and one fpm,
> because my websites aren't exactly high traffic.
I do not anticipate heavy traffic. I could probably get by with
single nodes in each tier. But I would like keep the setup scalable,
so when the traffic load goes up, I am not scrambling for a fix (under
> For balancing, I guess you can use mod_proxy_balancer to balance between
> multiple fpm nodes:
I'll take a look at it.
Thanks again for your insight.
-- Arun Khan
More information about the CentOS