Nginx: Run fastcgi process under individual owners, like suexec on Apache

nginxSecurityusersvirtualhost

I've had issues with Apache 2 on my server of which I had an Apache2-worker/php-fpm setup and am migrating to Nginx.

I've followed various guides to set up the wrapper script for fastcgi spawning for PHP-cgi and Nginx, however I can find no guide on running the actual cgi script under specific users.

i.e. this Linode guide (and others) hardcoding the wrapper in an init.d script:
http://library.linode.com/web-servers/nginx/php-fastcgi/debian-6-squeeze

Right now I have made a script to add a user/group for each individual vhost directories, and chowning the public_html directories – however this seems useless as the PHP process will still be ran under the www-data user.

Any guides for doing this? Am I just searching the wrong things this late?

Best Answer

Fastcgi does not have user switching, so you have to spawn a process(or multiple) for each of your users. PHP-FPM makes this very easy via pools, and you should be using that over vanilla php-cgi any way.