Nginx + php + fpm plug'n'play configuration
francis at daoine.org
Tue Apr 5 15:51:43 MSD 2011
On Tue, Apr 05, 2011 at 11:59:43AM +0200, Daniele Pignedoli wrote:
> Hi francis, many thanks for your suggestion, with that i've been able to
> setup a 'almost-work' enrivonment!
> I have a file i my /etc/nginx/sites-available/ (softlinket do sites-enabled)
> that looks as follow:
OK, so you've gone for "one nginx which can read all files".
Your config looks to me like it should work ok.
> Then, in my /etc/php5/fpm/fpm.d/ i just create a new file for each
> subdomain, for example:
And this is "one fpm that runs many instances as different users", which,
as you have spotted, needs a restart for a changed user.
> This isnt the "plug'n'play" behavior i was looking for, becose in order to
> activate new domains i have to run `/etc/init.d/php-fpm reload`;
I think I had suggested just running one fcgi server per user, which would
avoid the "restart" thing. That would probably be the equivalent to your
> php5-cgi -b /var/run/php5-fpm-test_bar.sock
Of course, that's all php or fpm stuff, rather than nginx stuff. So:
> Then, running a cron task that every night kill all the php5-cgi instances
> and then reload the fpm configuration.
...while I think that will probably work ok, you may find better
Note that on the nginx side, you haven't got anything specific relating to
> > > So, for every requests to *.example.com, i need to:
> > > 1. check if user and folder exists
that. But your testing will show what response you get, and you can
decide whether that is adequate for you.
Good luck with it,
Francis Daly francis at daoine.org
More information about the nginx