简体   繁体   English

Laravel 5正确的权限,仍然失败

[英]Laravel 5 correct permissions, still failing

As per numerous references online, Laravel documentation, and scouring answers here on SO, I am a bit baffled as to why I have set my directory permissions precisely as expected, but still am getting "Permission Denied" fatals. 根据在线上的大量参考资料,Laravel文档以及关于SO的精练答案,我对为什么我完全按照预期设置了目录权限却感到困惑,但仍然遇到“权限被拒绝”的问题。

I have applied the following to the storage & bootstrap/cache directories. 我已将以下内容应用于存储和bootstrap / cache目录。

chown -R apache:apache storage bootstrap/cache
chmod -R ug+rwx storage bootstrap/cache

Just shy of being a total security idiot and 777'ing those directories...which I will NOT do. 只是羞于成为一个完全安全的白痴,然后为那些目录添加777'...我不会 (So, please do not even bother offering that as a suggestion!) I'm at a loss for what could still be wrong here. (因此,请不要甚至不提这个建议!)我很茫然,因为这里可能仍然有问题。

Anyone else dealt with this? 还有其他人处理吗?

GAME CHANGER UPDATE NOTE: I just discovered the cause. 游戏更改更新注意:我只是发现了原因。 Which drastically changes the scope of this question now. 现在,这极大地改变了这个问题的范围。 It seems that selinux was the issue. 看来selinux是问题所在。 When I did setenforce 0, this fixed the problem. 当我设置为0时,此问题得以解决。

So, now the question is what do I need to do in selinux to make this work without disabling selinux entirely? 因此,现在的问题是,在不完全禁用selinux的情况下,我需要在selinux中做什么才能使其正常工作?

Okay...so, it seems that the answer lies in setting up selinux to allow apache to have rw access to directories. 好吧...所以,答案似乎就在于设置selinux以允许apache拥有对目录的rw访问权限。 ( All commands ran as root ) 所有命令都以root身份运行

First, run this command (assuming an OS of RHEL/Centos); 首先,运行此命令(假设RHEL / Centos的操作系统);

chcon -R -t httpd_sys_rw_content_t /path/to/web/root

Then make that change persistent with this command; 然后使用此命令使更改保持不变;

semanage fcontext -a -t httpd_sys_rw_content_t "/path(/.*)?"

This fixed my problem! 这解决了我的问题!

Solution found here; 解决方案在这里找到; SELinux Apache Setup for Web Servers 用于Web服务器的SELinux Apache设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM