I solved my own problems.
For the sudo permissions, I executed sudo visudo
and added the line Defaults umask = 0002
to the end.
For the Apache user, I added the line umask 0002
to the end of the /etc/apache2/envvars
(I couldn't find any better solution).