#!/bin/bash -x

chown -R www-data:www-data .
find . -type f -exec chmod 664 {} \;
find . -type d -exec chmod 775 {} \;
find var vendor pub/static pub/media app/etc -type f -exec chmod ug+w {} \;
find var vendor pub/static pub/media app/etc -type d -exec chmod ug+ws {} \;
chmod ug+x bin/magento
chmod ug+x bin/set_default_permissions
chmod ug+x vendor/bin/*
