As Tero has suggested, you would need to change the user of your php-fpm process responsible for hosting the site you'd like to affect.
PHP-FPM has "pools" and I think most administrators will typically have one pool per site hosted. So, if you're hosting example.com and another-example.com, you could have two php-fpm pools that each run their respective site. The benefit of different pools is that you can define configuration for each separately (and thus run the processes as different users/groups).
You didn't specify your distribution/config, so I can only tell you that your pool config files are probably located at /etc/php-fpm.d/*.conf
. So, you could have /etc/php-fpm.d/example.com.conf
with:
[example.com]
user = john
group = www-data
...
And then another pool /etc/php-fpm.d/another-example.com.conf
with:
[another-example.com]
user = sally
group = www-data
...
The php-fpm configs are in INI format, and what I posted is only the relevant user/group directives. There are more configuration options necessary for a proper pool definition. See the "List of Pool directives" section on this page for more information on that.
You will need to restart your php-fpm service to make pool changes effective. You can test your configuration before restarting (and thus avoid possible downtime) with php-fpm -t
on most systems. I think some distributions use php5-fpm -t
.
Lastly, yes, as you said, the nginx.conf user/group directives only affect Nginx. PHP-FPM runs as a separate process, more or less independent of Nginx.