I've tried 3 times now to install Magento 2 each time facing issues with permissions.
On initial upload I get 500 server errors because the permissions don't allow access to the files.
I can work around this by setting the following permissions in SSH:
find . -type f -exec chmod 644 {} \; find . -type d -exec chmod 755 {} \; find ./var -type d -exec chmod 777 {} \; 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
This gives me enough access to install the site.
After which there's further issues in that the style sheets and JavaScript create the same 500 error from the beginning.
Again playing around with the permissions can fix this, with a little more difficulty.
But even then any new file introduced (product image for example) will have the wrong permissions and cause the 500 error.
--
There must be a way to do this "properly" can anyone help.
- Donovan
How to diagnose «500 Internal Server Error»: https://mage2.pro/t/854
Thank-you Dmitry_Fedyuk, but I know that the errors are being caused by the incorrect file permissions, so that doesn't need diagnosing. What I'm looking for is the correct way to deal with the problem.
Why do you assure this is 100% because of permissions?
Because tweaking the permissions temporarily fixes the problems.
I managed to bypass most of the issues by using an auto installed (Softaculos) but the instant I installed a new extension the permission problems came rushing back.
This happened after running the following commands via SSH
php -f bin/magento module:enable LitExtension_Core
php -f bin/magento module:enable LitExtension_CartServiceMigration
php -f bin/magento setup:upgrade
php -f bin/magento setup:static-content:deploy
Any suggestions would be appreciated.
I am not sure if it's directly related but I believe there are a couple of hard-coded permission settings in the following system files:
/vendor/magento/framework/Filesystem/DriverInterface.php
and
/lib/internal/Cm/Cache/Backend/File.php
Of course, if correcting these hard-coded settings resolves the issue - these changes may get lost with future upgrades over-writing these system files.