I installed Magento with sample data and getting 404 errors. I chowned directory with my username and web group http. I am running Nginx by the way. It says permission denied in my pub media and static folders did the following and still getting errors. Ian at a loss
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 {} + sudo chown -R :http . chmod u+x bin/magento
It looks like a file ownership/permissions mismatch issue. For Magento to serve assets correctly with Nginx, make sure the pub/static and pub/media directories are both writable by the web server user. Double-check that the directories are owned by your current user and the group that Nginx runs under, and that group write/execute is set on both files and folders.
Also confirm that bin/magento is executable and re-deploy static content after adjusting permissions. A quick flush of the cache usually helps as well.
Hi @tmccaff57g5da8 ,
Replace <youruser> with your SSH/deploy user and /path/to/magento with your Magento root.
1)
sudo chown -R <youruser>:http /path/to/magento
2)
cd /path/to/magento
sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 755 {} \;
3)
sudo find var pub/static pub/media app/etc -type f -exec chmod g+w {} \;
sudo find var pub/static pub/media app/etc -type d -exec chmod g+ws {} \;
4)
sudo chmod u+x bin/magento
5)
sudo -u <youruser> php bin/magento maintenance:enable
sudo rm -rf pub/static/* var/cache/* var/page_cache/* var/view_preprocessed/* generated/*
sudo -u <youruser> php bin/magento setup:upgrade
sudo -u <youruser> php bin/magento setup:di:compile
sudo -u <youruser> php bin/magento setup:static-content:deploy -f
sudo -u <youruser> php bin/magento cache:flush
sudo -u <youruser> php bin/magento maintenance:disable
Reload frontend and backoffice url again and check var/log/system.log as well as var/log/exception.log files for more information about issues.
Problem Solved? Accept as Solution!
Thanks,
Ankit
A permission issue during Magento 2 installation usually means files or folders don’t have the correct read/write access