I've followed a couple of tutorials and configured Apache to use PHP FPM. However, I do not understand what part of the SetHandler
line is doing and based on some of my experiments appears to be redundant. I have the line:
SetHandler "proxy:unix:/run/php/php7.3-fpm.sock|fcgi://localhost"
This works whether the |fcgi://localhost
is present or not.
In various place, such as Plesk configuration, I've seen the portion fcgi://localhost
replaced with fcgi://127.0.0.1:9000
What is the purpose of the |fcgi://localhost
? Is it redundant and can it be removed?
Is the pipe, separating sock and fcgi in sock|fcgi
to be interpreted as an 'or', meaning if the unix socket is not present, use the tcp connection instead?
In my FPM pool configuration I've tried replacing the listen directive with a host and port, also with just a port, but I can't seem to get it to work. How would you configure PHP FPM to be available via TCP rather than a unix socket? I've no reason to want to do this at the moment, its just for learning.
Finally. Is this the correct 'stack' site to ask this question?
Edit to say I've found a small bit of documentation from Apache. The final example in the example section talks about using the |fcgi://something
in the context of forcing a reverse proxy request, but I really don't understand this.
SetHandler proxy:unix:...
I haven't found a complete explanation of it anywhere yet.localhost
is the same as127.0.0.1
. The example specified a custom port (9000
) instead of the default port. I do not know of the top of my head which port FCGI uses by default.|fcgi://localhost
in the samples I've found and in the Apache docs, when the configuration works without it. What does it mean, what does it do, when and why would you choose to use it?