In recent Ubuntu versions (no idea if this is inherited from Debian or not), the apache user is set in /etc/apache2/envvars, which is processed when Apache is [re]started via /etc/init.d/apache2 [re]start.
However, running apache outside that script will then cause errors. So for example, apache2 -t .. which should test the configuration without restarting, instead generates errors "bad user name" errors because the environment variable relied upon in apache2.conf is not being set.
So, is there a "correct" way to test the configuration?
(The solution I always end up with is editing apache2.conf to set User/Group to www-data directly.)
As an aside, is there any way to make logrotate not kill Apache if there's an error in the apache configuration file?