Standalone / separate server as PHP processor for other nodes

Andres B asked:

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]

You could have fastcgi_pass redirect to any IP address ( to be safe or, 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.

My answer:

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.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.