This is happening for the first time after months of developing. I don't know what changed.
We set file permissions and then We run in Magento2 root folder:
sudo chown -R user:apache .
But, every time We run commands like.
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
composer install
composer update
and every time some of the users in apache group modifies any file We get that file changes to user:user group. So, nobody else in apache group can access files (neither apache itself, so naturally website breaks).
How can I set to keep :apache as group owner?
EDIT:
So, I followed this instructions and was able to get modified files to keep the apache group ownership: https://serverfault.com/questions/46886/linux-losing-group-ownership-of-files but still the new uploaded files by different users are owned by user:user instead of user:apache. How could I solve this?