When I upload files through php, it writes the file with the permissions 644 (-rw-r--r--). 

I have my /var/www/html folder setup with setgid, so that all files uploaded are set to a group that should be allowed explicit access (FTP, etc). However, 644 permissions do not allow the group of the file to write, which is a problem. 

How can I configure apache2, so that all files/directories created by www-data within the /var/www/html folder have the permissions 775 (-rwxrwxr-x) set to them? 

I am running Ubuntu 14.04 on a DigitalOcean VM with Apache 2.2.