I have a setup with two small servers running nginx serving as proxy and a number of Apache+mod_php beefy servers. I am thinking on going over to PHP-FPM. Can I configure nginx to use a number of FastCGI servers? Or PHP-FPM itself to use workers on different machines? Or do I need to run nginx on the workers?
2 Answers
no you can run 1 nginx machine and many php-fpm machines.
upstream php { server 10.0.0.1:9000; server 10.0.0.2:9000; server 10.0.0.3:9000; } Then in your locaction
fastcgi_pass php; - Thanks! That was totally not clear from the documentation.chx– chx2010-12-28 11:31:16 +00:00Commented Dec 28, 2010 at 11:31
- What about keep alive connections? What should the number of keep alive be?CMCDragonkai– CMCDragonkai2014-04-15 04:09:53 +00:00Commented Apr 15, 2014 at 4:09
A complement to Mike's answer.
Check this vulnerability that can arise when you have nginx and PHP-FPM in different servers. The bottom line is: don't allow users to upload content to your public directory.