3

From what I've seen in various docs and example configurations, you could have PHP-FPM set up on a different server/hardware, separate from your webserver (nginx in my case).

While most examples list some variation of this:

location ~ \.php {
    [various parameters]
    fastcgi_pass 127.0.0.1:9000;
}

You could have fastcgi_pass redirect to any IP address (192.168.1.10 to be safe or 200.55.35.40, go crazy!), thus delegating PHP processing to a different server.

My questions are: those separate servers must have the PHP files accessible within their filesystem, right? If yes, how do I configure the root directory for PHP to find the files, given that it's something usually done in nginx's config (in my case). Is it via chroot and chdir parameters in the pool config or whatever I send as SCRIPT_FILENAME from nginx?

Now the most interesting part (for me): if having the files on that server isn't necessary (and nginx provides the file to the ip:port in fastcgi_pass), how do includes work?

I was just thinking about setting up a bunch of PHP-FPM servers and let them bear the processing load of a Wordpress Multisite node, without having to rsync tons of stuff back and forth.

1
  • 1
    Yes, the files need to exist on the PHP nodes.
    – ceejayoz
    Oct 5, 2013 at 16:28

2 Answers 2

2

The files need to exist on the PHP backend server as well, and they have to be in the exact same path as on the webserver itself. PHP doesn't know anything about translating script file paths, so it uses the path as it is passed from the frontend server.

1
  • Anyway to get around not having the files on both on FE and BE servers? Jun 3, 2016 at 10:26
1

The easiest way to do this is to place all the files in shared storage (i.e. an NFS mount), which is then mounted to the same mount point on all of the servers. Then, you do not need to do any sort of rsync or other copying.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .