由于某种原因,我不得不将 Laravel 存储文件夹设置为 777。
我运行这个命令sudo chmod -R 775 storage/
并且我的权限错误未解决,因此我通过运行此命令将权限从 775 更改为 777sudo chmod -R 777 storage/
我的问题是 777 权限可能会导致我的 laravel 出现任何问题(禁止访问 || 安全),还是可以?
这是我找到的最佳解决方案。
步骤1:chown根目录:
sudo chown -R www-data:www-data /path/to/root
步骤 2:授予 FTP 上传和处理文件的权限(用于使用任何 FTP 客户端):
sudo usermod -a -G www-data ubuntu
步骤3:将文件权限设置为644:
sudo find /path/to/root -type f -exec chmod 644 {} \;
步骤4:设置目录权限为755:
sudo find /path/to/root -type d -exec chmod 755 {} \;
步骤5:授予Web服务器读写存储和缓存的权限
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
Source: https://vijayasankarn.wordpress.com/2017/02/04/securely-setting-file-permissions-for-laravel-framework/ https://vijayasankarn.wordpress.com/2017/02/04/securely-setting-file-permissions-for-laravel-framework/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)