Skip to content

Instantly share code, notes, and snippets.

@trungpv1601
Last active April 3, 2019 08:00
Show Gist options
  • Save trungpv1601/0ea6214c574a6eb039785edf41c41fca to your computer and use it in GitHub Desktop.
Save trungpv1601/0ea6214c574a6eb039785edf41c41fca to your computer and use it in GitHub Desktop.
Magento 2 ownership and permissions
cd <your Magento install dir> 
find . -type f -exec chmod 644 {} \;                        // 644 permission for files
find . -type d -exec chmod 755 {} \;                        // 755 permission for directory 
find ./var -type d -exec chmod 777 {} \;                // 777 permission for var folder    
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
chown -R :<web server group> .
chmod u+x bin/magento

https://devdocs.magento.com/guides/v2.3/install-gde/composer.html

cd /var/www/html/<magento install directory>
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chown -R :www-data . # Ubuntu
chmod u+x bin/magento
  • Refresh CSS, JS, static file.
php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy -f

php bin/magento cache:clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment