简体   繁体   English

centos 7 laravel 日志 - 由 root 拥有的每天创建新的日志文件存储需要 apache 成为日志文件的所有者

[英]centos 7 laravel log - everyday new log file instorage gets created owned by root need apache to be owner of log file

I have this strange issue on Cent os 7, where i have installed laravel.我在 Cent os 7 上遇到了这个奇怪的问题,我在其中安装了 laravel。

I have installed apache httpd server and granted access to the laravel Logs directory.我已经安装了 apache httpd 服务器并授予对 laravel 日志目录的访问权限。

Everything works fine if I set the owner of the log files to apache.如果我将日志文件的所有者设置为 apache,一切正常。

So what happens is laravel creates a new log file daily in the storage folder and when it does all of a sudden the owner of that new log file for example laravel-2020-05-22.log is no longer apache but root.所以发生的事情是 laravel 每天在存储文件夹中创建一个新的日志文件,当它突然发生时,该新日志文件的所有者,例如 laravel-2020-05-22.log 不再是 apache 而是 root。

So thats my issue, I have to everyday go to the log file and change its owner from root to apache for it to work.所以这就是我的问题,我必须每天将 go 更改为日志文件,并将其所有者从 root 更改为 apache 才能正常工作。

sudo chown -R apache:apache /var/www/html/laravel/storage/logs

I have already executed the command to make apache the owner of the logs directory recursively.我已经执行了命令以递归方式使 apache 成为日志目录的所有者。

How do i make the new logs that are being created daily be automatically owned by apache and not root?我如何使每天创建的新日志自动归 apache 而不是 root 拥有?

The easiest hassle free way to solve it was to stop logs from being written into the storage folder and just save it into a logging database instead.解决这个问题的最简单的无忧方法是停止将日志写入存储文件夹,而是将其保存到日志数据库中。

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

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