How to configure PHP-FPM over NGINX to write in per-virtualhost log files
Solution 1:
The PHP-FPM directive: catch_workers_output = yes
will cause errors PHP sends to stdout/stderr to be sent back to nginx, and they will be logged.
In PHP 5.2.4 and newer, the directive display_errors is no longer a boolean, but will accept 'stderr' as an option. This should cause all of the errors to go back to nginx, and be logged per vhost.
So in your PHP-FPM config:
php_admin_value[display_errors] = 'stderr'
Your other option is the directive:
php_admin_value[error_log] = /var/log/fpm-php.www.log
which is what you are likely using now. the php-fpm.conf supports some variables, like $pool (which for you, will likely return 'www').
If you have more than 1 pool, you can easily log them separately.
From a quick browse through the source code, it looks like $pool is the only such variable though.