I have centos 7 installed with nginx on a dedicated machine, running symfony (PHP) applications. Every site has its own user, in this example let's say its "user" in the "hostings" group. Application required console commands run like
$ php bin/console cache:clear
In this case the application's folder /var/cache will be created with "user:hostings" owner.
The problem is, when a visitor arrived on the site (nginx / webserver runs the application), it usually creates some additional files too in the same /var/cache directory, with "nginx:nginx" ownership.
So if one of the files are can't write with another's permission, it generates server 500 error.
What is the best scenario here? Should I change "nginx" user's group to "hostings" or "user:hostings" to "user:nginx" ? Or something else here?