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://

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.

  • 2
    Yes, this is the right place. See also my question about SetHandler proxy:unix:... I haven't found a complete explanation of it anywhere yet. Nov 29, 2020 at 13:10
  • @AndrewSchulman I've just updated my question to point towards some Apache documentation, which I've found, but which I don't understand.
    – Dom
    Nov 29, 2020 at 15:36
  • Can you share the goal you are trying to achieve and the rest of your relevant configuration? localhost is the same as 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.
    – Tommiie
    Dec 1, 2020 at 12:18
  • 1
    @Tommiie My goal is to understand the inclusion of |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?
    – Dom
    Dec 1, 2020 at 15:02

1 Answer 1


The documentation clearly states why you should include it even though it is not mandatory:

For performance reasons, you will want to define a worker representing the same fcgi:// backend. The benefit of this form is that it allows the normal mapping of URI to filename to occur in the server, and the local filesystem result is passed to the backend. When FastCGI is configured this way, the server can calculate the most accurate PATH_INFO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.