錯誤碼:
Warning: Unit file of apache2 changed on disk, 'systemctl daemon-reload' recommended
解決辦法:
在 /etc/logrotate.d 的apache2檔案中
/var/log/apache2/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
if /etc/init.d/apache2 status > /dev/null ; then \
/bin/systemctl daemon-reload; \
/etc/init.d/apache2 reload > /dev/null; \
fi; \
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi; \
endscript
}
加入紅色粗體字那行,儲存檔案
並執行
sudo systemctl daemon-reload
即可執行
sudo service apache2 restart
PS.若apache2檔案無法寫入,可用
sudo chown pi:root apache2
更改擁有者
參考資料:https://www.raspberrypi.org/forums/viewtopic.php?t=160476