简体   繁体   中英

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.

I have installed apache httpd server and granted access to the laravel Logs directory.

Everything works fine if I set the owner of the log files to 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.

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.

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.

How do i make the new logs that are being created daily be automatically owned by apache and not 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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